[Haskell-cafe] Human-friendly compiler errors for GHC

Max Bolingbroke batterseapower at hotmail.com
Sat Jul 12 19:11:11 EDT 2008


> That's pretty cool.  Unfortunately in my early Haskell days the 'not
> in scope' errors were the only ones I _did_ understand.

Heh :-)

> 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.

Yep, this would only be one small step forward in error message quality.

> 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.

Agreed: I've implemented this too. I've also added fuzzy matching to
package search:

"""
$ stage2/ghc-inplace --make ../Test1.hs

../Test1.hs:3:7:
    Could not find module `Data.Lost':
      Use -v to see a list of the files searched for.
      Maybe you meant `Data.List'

$ stage2/ghc-inplace --make ../Test2.hs
[1 of 1] Compiling Main             ( ../Test2.hs, ../Test2.o )

../Test2.hs:7:14:
    Not in scope: `isSpace'
    Maybe you meant `Char.isSpace'
"""

> 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...

I can think of a few times it would have helped me out, with
identifiers that may or may not be pluralized or have suprising
capitalisation. I don't know though, I guess you'd have to work with
the feature turned on for a while to work out if it really was useful.

I think this feature has shaped up pretty nicely after the helpful
suggestions I recieved. I don't know if I'll be able to get the patch
into GHC proper, though..

Max


More information about the Haskell-Cafe mailing list