[GHC] #9581: Parse error in multiline case expression inside let inside do block

GHC ghc-devs at haskell.org
Thu Sep 11 21:41:38 UTC 2014


#9581: Parse error in multiline case expression inside let inside do block
-------------------------------------+-------------------------------------
       Reporter:  mpopov             |                   Owner:
           Type:  bug                |                  Status:  new
       Priority:  normal             |               Milestone:
      Component:  Compiler           |                 Version:  7.8.3
       Keywords:                     |        Operating System:  Linux
   Architecture:  Unknown/Multiple   |         Type of failure:  GHC
     Difficulty:  Unknown            |  rejects valid program
     Blocked By:                     |               Test Case:
Related Tickets:                     |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------
 {{{#!hs
 main = do
     let x = case 1 of
         0 -> False
         _ -> True
     print x
 }}}

 The above program produces the following error:
 $ runghc bug.hs
 bug.hs:3:11: parse error on input ‘->’

 Slightly rewritten versions print True as indended:

 {{{#!hs
 main = do
     let x = case 1 of { 0 -> False; _ -> True }
     print x

 main = do
     print $ case 1 of
         0 -> False
         _ -> True
 }}}

 I have double-checked that the offending program does not contain mixed
 tabs and spaces.

 The same error occurs on my own system (Linux Mint x64, Haskell Platform
 2014.2 with GHC 7.83) and in FPComplete's online IDE.

 I first encountered the error in a program copied verbatim from a Haskell
 book, so i assume that the syntax is allowed.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9581>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list