GHCI cannot load a module if it contains both packages and the source path

I am faced with a strange situation at GHCI, I don’t know if anyone has seen a similar case. For some module, when it is on the search path with both -package-conf and -i , GHCI fails when I try to import a module using 'module is not loaded: FooModule' .

  • :module loads it, however
  • or I can do :load FooModule :m to clear the import list, and then import FooModule
  • or I can remove the path from -i and then import the fine

It tracks this as the case otherwise -> modNotLoadedError m loc in the GHC , where otherwise ~ modulePackageId = this_pkg (the meaning of which I do not know).

This is not completely systematic, there are some modules that are in the package and source path, but can be imported.

+50
haskell ghci
Mar 28 '14 at 15:40
source share
1 answer

GHC only knows about installed packages. To find out which packages are installed, use the ghc-pkg list command:

 $ ghc-pkg list /usr/lib/ghc-6.12.1/package.conf.d: Cabal-1.7.4 array-0.2.0.1 base-3.0.3.0 base-4.2.0.0 bin-package-db-0.0.0.0 binary-0.5.0.1 bytestring-0.9.1.4 containers-0.2.0.1 directory-1.0.0.2 (dph-base-0.4.0) (dph-par-0.4.0) (dph-prim-interface-0.4.0) (dph-prim-par-0.4.0) (dph-prim-seq-0.4.0) (dph-seq-0.4.0) extensible-exceptions-0.1.1.0 ffi-1.0 filepath-1.1.0.1 (ghc-6.12.1) ghc-prim-0.1.0.0 haskeline-0.6.2 haskell98-1.0.1.0 hpc-0.5.0.2 integer-gmp-0.1.0.0 mtl-1.1.0.2 old-locale-1.0.0.1 old-time-1.0.0.1 pretty-1.0.1.0 process-1.0.1.1 random-1.0.0.1 rts-1.0 syb-0.1.0.0 template-haskell-2.4.0.0 terminfo-0.3.1 time-1.1.4 unix-2.3.1.0 utf8-string-0.3.4 
+1
Dec 03 '14 at 5:18
source share



All Articles