#16358: Confusing ghci error message

"GHC" <[email protected]>
Newsgroups gmane.comp.lang.haskell.glasgow.bugs
Message-ID <[email protected]>
#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>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.