[GHC] #8081: let form in do block requires in?

#8081: let form in do block requires in? ----------------------------+---------------------------------------------- Reporter: dsamperi | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Keywords: | Operating System: Linux Architecture: x86_64 | Type of failure: GHC rejects valid program (amd64) | Test Case: Difficulty: Unknown | Blocking: Blocked By: | Related Tickets: | ----------------------------+---------------------------------------------- According to the 2010 Haskell spec the following should be equivalent: do1 = do { let x = 3.14 ; return x } and do2 = let x = 3.14 in do { return x } But ghc 7.6.3 chokes on the first (do1) with "parse error on input '}'" On the other hand, if I use layout and set do3 = do let x = 3.14 return x there is no problem. Also, the compiler doesn't complain if I insert "in" in place of the semicolon in do1 (but this doesn't seem to follow the spec). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8081 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8081: let form in do block requires in? ----------------------------------------------+---------------------------- Reporter: dsamperi | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: invalid | Keywords: Operating System: Linux | Architecture: x86_64 Type of failure: GHC rejects valid program | (amd64) Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: ----------------------------------------------+---------------------------- Changes (by igloo): * status: new => closed * resolution: => invalid Comment: Thanks for the report. However, the problem isn't that `in` is needed, but is due to the implicit layout for the `let` not behaving as you expect. If you use explicit layout for the `let` too then it is accepted: {{{ do1 = do { let { x = 3.14 } ; return x } }}} You can also use implicit layout if you lay the code out differently: {{{ do1 = do let x = 3.14 return x }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8081#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC