GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2019-07-07T18:02:44Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/15849Error message: "Perhaps you need a let in a do block", when there is no do bl...2019-07-07T18:02:44Zcdsmith@twu.netError message: "Perhaps you need a let in a do block", when there is no do block.This code:
```haskell
main = return ()
foo = return ()
```
Gives the error message:
```
parse error on input ‘=’
Perhaps you need a 'let' in a 'do' block?
e.g. 'let x = 5' instead of 'x = 5'
```
But this isn't in a do block....This code:
```haskell
main = return ()
foo = return ()
```
Gives the error message:
```
parse error on input ‘=’
Perhaps you need a 'let' in a 'do' block?
e.g. 'let x = 5' instead of 'x = 5'
```
But this isn't in a do block. It would be awesome if GHC checked whether there's a do block before giving a suggestion that depends on there being a do block.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Error message: \"Perhaps you need a let in a do block\", when there is no do block.","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"This code:\r\n\r\n{{{#!haskell\r\nmain = return ()\r\n foo = return ()\r\n}}}\r\n\r\nGives the error message:\r\n\r\n{{{\r\nparse error on input ‘=’\r\n Perhaps you need a 'let' in a 'do' block?\r\n e.g. 'let x = 5' instead of 'x = 5'\r\n}}}\r\n\r\nBut this isn't in a do block. It would be awesome if GHC checked whether there's a do block before giving a suggestion that depends on there being a do block.","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1Alex DAlex D