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

GHC ghc-devs at haskell.org
Wed Jan 13 09:22:46 UTC 2016


#11418: Suggest correct spelling when module is not found because of typo
-------------------------------------+-------------------------------------
           Reporter:  syd            |             Owner:
               Type:  feature        |            Status:  new
  request                            |
           Priority:  lowest         |         Milestone:
          Component:  Compiler       |           Version:
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Given these two modules:

 Aaa.hs:
 {{{#!hs
 module Aaa where

 import           BBb

 main :: IO ()
 main = putStrLn myString
 }}}

 Bbb.hs:
 {{{#!hs
 module Bbb where

 myString :: String
 myString = "hi"
 }}}

 There's a typo in `Aaa.hs`, the import should be `Bbb` instead of `BBb`.

 Running `runhaskell Aaa.hs` results in this error:

 {{{
 Aaa.hs:3:18:
     Could not find module ‘BBb’
     Use -v to see a list of the files searched for.
 }}}

 The request is to have the compiler suggest that this is a typo and that
 it should be `Bbb` instead.
 It already does this for misspelled functions, if I recall correctly.

 Because the compiler will not continue when finding an error like this, it
 won't be harmful to spend a little extra time looking for possible
 misspellings.

 How typo's should be recognized is something that should be fleshed out
 later. For example, a hamming distance of 2 or less could indicate a typo.

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


More information about the ghc-tickets mailing list