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

GHC ghc-devs at haskell.org
Sun Jan 17 21:14:24 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):

 Ok, let's back up.

 > Does that mean ghc hammers the file system with guesses for every
 import?

 Given the two files from the description, here's what happens when you run
 `ghc Aaa.hs`:
 * GHC asks the OS to open `./Aaa.hs`, and reads its contents
 * GHC figures out it needs module `BBb`
 * GHC "guesses" that `BBb` is either in `./BBb.hs` or in `./BBb.lhs`
 * GHC asks the OS to open those two files in order
 * Since neither file exists, an error message is shown (after also
 consulting the package database, but let's ignore that for the moment)

 So in total GHC tries to open 3 files: `Aaa.hs`, `BBb.hs` and `BBb.lhs`.
 It doesn't have to ask the OS for a list of all files in the directory.

 If you run `ghc Aaa.hs` again later, it will do the exact same thing.
 There is no cache.

 Even if there are another one million files in the current directory, GHC
 still has to only open those 3 files. It doesn't "hammer" the file system.

 > Is there not some sort of cache of previously found modules that we can
 check?

 Not in the above scenerio. But just to be clear: do you mean a cache that
 could be used between separate invocations of GHC, or within a single
 invocation of GHC?

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


More information about the ghc-tickets mailing list