[GHC] #13450: Better parse error for empy character literal
GHC
ghc-devs at haskell.org
Sun Mar 19 02:42:50 UTC 2017
#13450: Better parse error for empy character literal
-------------------------------------+-------------------------------------
Reporter: parsonsmatt | Owner: (none)
Type: feature | Status: new
request |
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: Poor/confusing
Unknown/Multiple | error message
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
Empty character literals give an obscure error message. As an example,
this code:
{{{#!hs
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.
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13450>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list