Better parse error for empy character literal
Empty character literals give an obscure error message. As an example, this code:
example = foo : bar
where
foo = ''
bar = "asdf"
gives the following error when loaded in GHCi:
err.hs:4:6:
parse error (possibly incorrect indentation or mismatched brackets)
This has affected me once, as a beginner. I've seen it affect a few other beginners, and the error message isn't very helpful to figuring out what's wrong.
It would be nice if a better error message could be reported. If there's a parse error on ''
, then GHC could report something like:
err.hs:3:11:
parse error on `''`.
Note: Character literals may not be empty.
Trac metadata
Trac field | Value |
---|---|
Version | 8.0.1 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |