
#16358: Confusing ghci error message -------------------------------------+------------------------------------- Reporter: lerkok | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.3 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: | -------------------------------------+------------------------------------- Description changed by lerkok: Old description:
{{{ $ 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`.
New description: {{{ $ 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`. Indeed, if I put this in a file, the error message is crystal clear: {{{#!hs $ cat a.hs import qualified Data.Set as S bar = S.foo $ ghci a.hs GHCi, version 8.6.3: http://www.haskell.org/ghc/ :? for help [1 of 1] Compiling Main ( a.hs, interpreted ) a.hs:3:7: error: Not in scope: ‘S.foo’ Module ‘Data.Set’ does not export ‘foo’. | 3 | bar = S.foo | ^^^^^ Failed, no modules loaded. }}} I'm curious why there's a difference between these two scenarios. -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16358#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler