[GHC] #11418: Suggest correct spelling when module is not found because of typo

GHC ghc-devs at haskell.org
Mon Jan 18 10:43:34 UTC 2016


#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 thomie):

 This feature could be called `-fhelpful-import-errors`. Do you think it
 should be enabled by default? 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
 }}}

 You could exclude subdirectories that don't start with an uppercase letter
 from the scan. But Windows paths are case-insensitive, so it wouldn't help
 there.

 Or stop scanning after the first N=1000 or so files (do some measurements
 to see what's reasonable).

 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

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11418#comment:18>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list