#2442: Heuristics to improve error messages for badly referenced things
-------------------------------+--------------------------------------------
Reporter: batterseapower | Owner:
Type: proposal | Status: new
Priority: normal | Component: Compiler
Version: 6.9 | Severity: normal
Keywords: | Testcase:
Architecture: Unknown | Os: Unknown
-------------------------------+--------------------------------------------
I propose the implementation of fuzzy-matching heuristics so we can get
errors like this:
{{{
Prelude> fsa
<interactive>:1:0:
Not in scope: `fsa'
Maybe you meant `fst'
Prelude> import Data.Lits
Could not find module `Data.Lits':
Use -v to see a list of the files searched for.
Maybe you meant `Data.Bits' or `Data.List'
Prelude>
}}}
And a heuristic such that when resolution of an unqualified name fails it
can suggest a qualified alternative:
{{{
module Main where
import qualified Char
main = print (isSpace ' ')
}}}
{{{
$ stage2/ghc-inplace --make Test.hs
[1 of 1] Compiling Main ( Test.hs, Test.o )
Test.hs:4:14:
Not in scope: `isSpace'
Maybe you meant `Char.isSpace'
}}}
I believe both of these represent an improvement to the compiler user
experience.
If you wish to implement this feature in GHC, I have implemented,
documented and tested it already and the patches are attached. It is under
flag control: use -fno-helpful-errors to disable it. This is turned by
default for the testsuite.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2442>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs