[GHC] #8840: standalone 'let' in do notation does not parse

#8840: standalone 'let' in do notation does not parse ------------------------------------+------------------------------------- Reporter: slyfox | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Keywords: | Operating System: Unknown/Multiple Architecture: Unknown/Multiple | Type of failure: None/Unknown Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | ------------------------------------+------------------------------------- When describing to a friend "do notation" syntactic equivalence some days ago I picked the following example: {{{ -- valid for ghc main = do let z = 1 print z }}} and tried to make it one-line for lambdabot: {{{ -- seems to be allowed explicitly by the spec -- http://www.haskell.org/onlinereport/haskell2010/haskellch3.html#x8-470003.14 main = do { let z = 1; print z } }}} Bug neither ghc-7.6.3 nor ghc-7.8.1-rc2 seem to accept it as valid: {{{ [1 of 1] Compiling Main ( a.hs, a.o ) a.hs:1:32: parse error on input ‘}’ }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8840 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8840: standalone 'let' in do notation does not parse -------------------------------------+------------------------------------ Reporter: slyfox | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Comment (by hvr): This is because `let` is a block-opening syntax element just like `do`; c.f. [http://www.haskell.org/onlinereport/haskell2010/haskellch2.html#x7-210002.7 Haskell Report 2010: Lexical Structure] If you write instead {{{#!hs do { let { z = 1 }; print z } }}} it should work... -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8840#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8840: standalone 'let' in do notation does not parse -------------------------------------+------------------------------------ Reporter: slyfox | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: invalid | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Changes (by slyfox): * status: new => closed * resolution: => invalid Comment: Oh, see. Didn't know {{{ f x = let a = 1; b = 2 g y = exp2 in exp1 }}} is a valid construct. My code did translated to {{{ main = do { let z = 1 print z } -- stray '}' }}} Closign as INVALID then. Thanks! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8840#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC