[Haskell-cafe] Re: ghc-pkg list says a package is installed, but ghci won't load its exposed module (HDBC-ODBC)

Simon Marlow simonmarhaskell at gmail.com
Fri Jun 15 04:12:37 EDT 2007

Thomas Hartman wrote:
> ghc-pkg list says a package is installed, but ghci won't load its
> module (HDBC-ODBC)
> Any advice?
> hartthoma at dbnycws28816 ~/haskellInstalls/HDBC-odbc-
> $ ghc-pkg list
> c:/ghc/ghc-6.6.1\package.conf:
>     Cabal-, GLUT-2.1.1, HAppS-0.8.4, HDBC-1.0.1,
>     HDBC-odbc-, HUnit-1.1.1, HaXml-1.13.2, OpenGL-2.2.1,
>     QuickCheck-1.0.1, Win32-2.1.1, base-2.1.1, cgi-3001.1.1,
> fgl-5.4.1,
>     filepath-1.0, (ghc-6.6.1), haskell-src-1.0.1, haskell98-1.0,
>     html-1.0.1, mtl-1.0.1, network-2.0.1, parsec-2.0, regex-base-0.72,
>     regex-base-0.91, regex-compat-0.71, regex-posix-0.71,
>     regex-tdfa-0.92, rts-1.0, stm-2.0, template-haskell-2.1,
>     time-1.1.1, xhtml-3000.0.2
> .....
> Prelude> :m + Database.HDBC.ODBC
> module main:Database.HDBC.ODBC is not loaded

It looks like your current directory contains Database/HDBC/ODBC.hs.  Move to a 
different directory, and you should be fine.

The reason this happens is that GHC finds Database/HDBC/ODBC.hs relative to the 
current directory, and assumes the module is therefore part of the "main" 
package (see the error message you got), which overrides the module of the same 
name from the HDBC package.  And you can't :m to a module in the "main" package, 
it has to be loaded with :load.


More information about the Haskell-Cafe mailing list