Skip to content

Error message: "Perhaps you need a let in a do block", when there is no do block.

This code:

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.

Trac metadata
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
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information