poor parser error message
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.
Trac metadata
Trac field | Value |
---|---|
Version | 6.12.3 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler (Parser) |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |