
#11418: Suggest correct spelling when module is not found because of typo -------------------------------------+------------------------------------- Reporter: syd | Owner: Type: feature request | Status: new Priority: lowest | Milestone: Component: Compiler | Version: Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by syd): Replying to [comment:18 thomie]:
This feature could be called `-fhelpful-import-errors`. Do you think it should be enabled by default? That depends. See below. We would have to ask others as well.
Not only does scanning a directory take time, there is also a memory cost. A pretty bad scenario would be running ghc in $HOME.
On my system: {{{ $ find ~ > all-files-in-home $ wc -l all-files-in-home 168014 all-files-in-home $ du -h all-files-in-home 14M all-files-in-home }}}
Yes. If we take this approach, the flag should definitely not be enabled by default.
Or stop scanning after the first N=1000 or so files (do some measurements to see what's reasonable). That is not feasable. We could miss out on modules we need. How about this partial solution: * A lot of people use Cabal for library development * Cabal already asks you to specify all known modules in either `exposed-modules` or `other-modules` (I guess you could make typos here..) * Cabal already passes this list of modules to GHC * So GHC already knows the names of all modules that could possibly be imported (not quite, see https://github.com/haskell/cabal/issues/2982#issuecomment-169786310) * Use that list of modules to make spelling suggestions on import errors
If we take this approach, then I think the flag should be enabled by default. However: I, for example, use makefiles during development instead of cabal because it allows for a faster code/compile/fix type errors cycle. This solution would therefore not help me at all. I prefer the situation in which this is a non-default flag and cabal is not required for it to function. Feedback welcome. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11418#comment:19 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler