[Haskell-cafe] Human-friendly compiler errors for GHC
lrpalmer at gmail.com
Sat Jul 12 14:40:07 EDT 2008
On Sat, Jul 12, 2008 at 10:44 AM, Max Bolingbroke
<batterseapower at hotmail.com> wrote:
> I had some free time this afternoon so I put together an
> (experimental) patch for GHC that implements helpful errors messages.
> Have a look at this GHCi session to see what I mean:
> $ stage2/ghc-inplace --interactive -fhelpful-errors
> GHCi, version 6.9.20080711: http://www.haskell.org/ghc/ :? for help
> Loading package ghc-prim ... linking ... done.
> Loading package integer ... linking ... done.
> Loading package base ... linking ... done.
> Prelude> let foo = 10
> Prelude> foa
> Not in scope: `foa'
> Maybe you meant one of:
> `not' -- Maybe the matching threshold could stand to be tweaked
That's pretty cool. Unfortunately in my early Haskell days the 'not
in scope' errors were the only ones I _did_ understand. It would be
nice to human-friendlify the other types of errors. I'm not judging
your work though, this is helpful, and the other types of errors are
of course much harder to friendlify.
On the topic of things that aren't stupid complaints by me, a typo is
the most likely cause for not in scope errors. As Evan points out, I
think it would be more helpful to search for matching names in
imported modules to see if the name was accidentally not qualified or
exported. I don't know about this fuzzy matching business, since when
I go to the line of the error message, I'm going to see my typo and
what I meant. I don't think I'd ever use the suggestions...
More information about the Haskell-Cafe