Bad error message for a misaligned case block in a do-let expression
Consider the following code:
main = do
code <- getCode
let value = case code of
1 -> 2
3 -> 4
_ -> 5
print value
This is a parse error, as the indent of the case statements is under the indent introduced by let. However, the error message on 8.6 onwards is very misleading:
/home/dkr/example/Bad.hs:2:8: error:
Unexpected do block in function application:
do code <- getCode
let value = ...
You could write it with parentheses
Or perhaps you meant to enable BlockArguments?
|
2 | main = do
| ^^...
Compare this with 8.4, which is a bit less bad:
/home/dkr/example/Bad.hs:5:6: error: parse error on input ‘1’
|
5 | 1 -> 2
| ^
Trac metadata
| Trac field | Value |
|---|---|
| Version | 8.6.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |