Skip to content

ghci + PackageImports behaves strangely

It seems that failed imports can affect later attempts at importing. For example, compare the following runs of ghci:

sorghum:~% ghci
GHCi, version 7.4.1: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> :set -XPackageImports
Prelude> import "mtl" Control.Monad.State
Prelude Control.Monad.State> 
Leaving GHCi.
sorghum:~% ghci
GHCi, version 7.4.1: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> :set -XPackageImports
Prelude> import "mtl-2.0.1.0" Control.Monad.State

Top level:
    Failed to load interface for `Control.Monad.State'
    It is not a module in the current program, or in any known package.
Prelude> import "mtl" Control.Monad.State

Top level:
    Failed to load interface for `Control.Monad.State'
    It is not a module in the current program, or in any known package.
Prelude> 
Leaving GHCi.
sorghum:~% ghc-pkg list mtl
/usr/local/lib/ghc-7.4.1/package.conf.d
   mtl-2.0.1.0
Trac metadata
Trac field Value
Version 7.4.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component GHCi
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information