[Haskell-cafe] Human-friendly compiler errors for GHC
Max Bolingbroke
batterseapower at hotmail.com
Sat Jul 12 12:44:52 EDT 2008
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
<interactive>:1:0:
Not in scope: `foa'
Maybe you meant one of:
`foo'
`fst'
`not' -- Maybe the matching threshold could stand to be tweaked
a bit, e.g. scaled with identifier string length..
Prelude> let myIdentifier = 10
Prelude> myIdentfiier
<interactive>:1:0:
Not in scope: `myIdentfiier'
Maybe you meant `myIdentifier'
Prelude>
""
The feature was inspired by the equivalent feature in the Boo
programming language (http://boo.codehaus.org/). I use the restricted
Damerau–Levenshtein distance to do the fuzzy match
(http://en.wikipedia.org/wiki/Damerau-Levenshtein_distance).
What do you think about this feature? Would it be genuinely helpful or annoying?
Max
More information about the Haskell-Cafe
mailing list