#5057: poor parser error message
---------------------------------+------------------------------------------
    Reporter:  duncan            |       Owner:                   
        Type:  feature request   |      Status:  new              
    Priority:  normal            |   Component:  Compiler (Parser)
     Version:  6.12.3            |    Keywords:                   
    Testcase:                    |   Blockedby:                   
          Os:  Unknown/Multiple  |    Blocking:                   
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown     
---------------------------------+------------------------------------------
 Here's the error message:
 {{{
 Blah.hs:52:0:
     parse error (possibly incorrect indentation)
 }}}

 Here's the last few lines of the file:
 {{{
     condition (foo "thing" <= bar (fromIntegral (a + b))
             && foo "other" > bar (fromIntegral(a - b))
                (baz 1) (baz 0)

 -- this is line 52, the apparent location of the error
 }}}

 Can you guess what the error is? Yes, of course '''we''' can, because
 we've seen this bad error message enough times to know that it really
 means
 {{{
 Blah.hs:47:15:
     unterminated '('
 }}}

 This error confuses new and casual users. It directs them away from the
 location of the error and provides a hint "possibly incorrect indentation"
 that will also send them in the wrong direction.

 Probably this message, and the parse error messages generally are not good
 because of limitations of happy. happy does not provide much to help
 construct error messages except the state of the parser at the time. The
 frown parser generator provides slightly more info, it provides the parse
 error function with the set of tokens that were expected at that point. If
 happy were extended in that way, that might be just enough to produce a
 better error since we could see that ')' was in the set of expected
 tokens.

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to