New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do
syntax can't handle wrapped let
forms
#1096
Comments
I don't think this is a "bug", but it's something we could opt to support. DO syntax has relatively tight allowance for what's allowed, and same for LET syntax. LET syntax itself doesn't allow fragments of DO to be used within its syntax. |
I consider this a bug. Do should support the full expression syntax. |
How much syntax? Is this OK?
I don't believe Haskell supports what you're suggesting.
Same thing with Rust's For these reasons I don't agree. |
no
From the grammar it looks like all expressions are valid statements. The following compiles on ghc 9.6.4: main = do
let x = "hello" in putStrLn x
putStrLn "world" |
@eliaslfox I might have read into your suggestion too much, thinking you were saying statements should be allowed anywhere within expressions (which is the last example of this issue). I agree then that expressions should be allowed, but statements (as they're called in the grammar) should only be in the syntax of do. Apologies for the misunderstanding. |
No worries. I missed that detail when reading the last example. The following compiles in Coalton currently:
It looks like the correct behavior is implemented. |
Here's an example:
Without let:
It also works with a standalone, non-wrapped let:
However it doesn't compile with a wrapped let:
Compiling
add-to-state-twice3
returns the error:The text was updated successfully, but these errors were encountered: