[GHC] #16358: Confusing ghci error message

GHC ghc-devs at haskell.org
Sat Feb 23 08:01:18 UTC 2019


#16358: Confusing ghci error message
-------------------------------------+-------------------------------------
           Reporter:  lerkok         |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.6.3
           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:
-------------------------------------+-------------------------------------
 {{{
 $ ghci
 GHCi, version 8.6.3: http://www.haskell.org/ghc/  :? for help
 Prelude> import qualified Data.Set as S
 Prelude S> S.foo

 <interactive>:2:1: error:
     Not in scope: ‘S.foo’
     No module named ‘S’ is imported.
 }}}

 I'm curious why `ghci` says `No module named 'S' is imported`. I found it
 very confusing.

 I'd have expected it to say one of three things:

 1. `Module Data.Set referenced via S does not export foo`
 2. `Constructor S not in scope`
 3. `Variable foo not in scope`

 The first one would be the most informative, but I can see that the second
 and the third messages might be quite reasonable as well due to the
 interpretation of dot as composition. But the message `No module S is
 imported` is quite confusing given I just issued `import qualified
 Data.Set as S`.

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


More information about the ghc-tickets mailing list