[GHC] #8501: Improve error message when using rec/mdo keyword without RecursiveDo extention.

GHC ghc-devs at haskell.org
Mon Nov 4 07:26:42 UTC 2013


#8501: Improve error message when using rec/mdo keyword without RecursiveDo
extention.
-------------------------------------+-------------------------------------
       Reporter:  shelarcy           |             Owner:
           Type:  feature request    |            Status:  new
       Priority:  normal             |         Milestone:
      Component:  Compiler (Parser)  |           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:  #3968              |
-------------------------------------+-------------------------------------
 GHC shows unhelpful error message when using rec keyword and/or mdo
 keyword without RecursiveDo extention.

 {{{
 module NoRecursiveDo where

 foo = do
     rec str <- return "foo"
     putStrLn str
 }}}

 {{{
 $ ghc -c NoRecursiveDo.hs

 NoRecursiveDo1.hs:4:5: Parse error in pattern: rec

 }}}

 {{{
 module NoRecursiveDo2 where

 bar = mdo
     str <- return "bar"
     putStrLn str
 }}}

 {{{
 $ ghc -c NoRecursiveDo2.hs

 NoRecursiveDo2.hs:4:9: parse error on input `<-'

 }}}

 {{{
 module NoRecursiveDo3 where

 baz = mdo
     putStrLn "baz"
 }}}

 {{{
 $ ghc -c NoRecursiveDo3.hs

 NoRecursiveDo3.hs:3:7:
     Not in scope: `mdo'
     Perhaps you meant `mod' (imported from Prelude)

 }}}

 I think that GHC should suggest to use RecursiveDo extention when using
 mdo/rec keyword.

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


More information about the ghc-tickets mailing list