Tue Apr 21 06:10:38 PDT 2009 Simon Marlow <[email protected]>
* FIX #2682: banish silly cases of the "module Foo is not loaded" error
Ignore-this: 15298691a63e13c63a68673202b1fc18
In GHCi if you say 'import Foo' meaning to load a package module Foo,
and Foo.hs is found on the search path, then GHCi replies "module Foo
is not loaded", because it knows Foo refers to the source file rather
than the package module, and you haven't loaded that module with
:load.
This is consistent with the usual module-finding semantics. However,
it isn't particularly useful. And it leads to silly problems like not
being able to start GHCi when you happen to be sitting in
libraries/base, because GHCi thinks the Prelude hasn't been loaded.
So now I've made a slight change to the way that 'import M' works: if
M is loaded, then it refers to the loaded module, otherwise it looks
for a package module M. This does what the reporter of #2682 wanted,
and since it turns an error condition into meaningful behaviour it
can't break anything.
The only undesirable consequence is that 'import M' might refer to a
different M than ':load M'. Hopefully that won't lead to confusion.
M ./compiler/ghci/InteractiveUI.hs -2 +2
M ./compiler/main/Finder.lhs +1
M ./compiler/main/GHC.hs -17 +53
View patch online:
http://darcs.haskell.org/ghc/_darcs/patches/20090421131038-12142-76d4f4a16c737999acce3fe08b526411cb583ff1.gz
_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc