[Haskell-cafe] HDBC PostgreSQL

Duncan Coutts duncan.coutts at googlemail.com
Sat Oct 10 09:04:13 EDT 2009


On Fri, 2009-10-09 at 14:56 -0500, Patrick Brannan wrote:
> Hello,
> 
> I'm getting back into Haskell after an absence of a few years. I'm in
> the process of trying to connect to postgresql with hdbc-postgresql on
> a Windows XP box.
> 
> Seemingly, things installed without  a problem, but at the command
> prompt I get the following:
> 
> Prelude> :module Database.HDBC Database.HDBC.PostgreSQL
> module `Database.HDBC.PostgreSQL' is not loaded
> 
> If I run ghci this way with package options here's what I get:
> 
> C:\work\haskell\HDBC-postgresql-2.1.0.0>ghci -package HDBC -package
> HDBC-postgresql


You are running it from within the source tree of the package itself.
Local sources take precedence over ones from packages. So you load the
-package HDBC-postgresql, but when you ask GHCi for :module
Database.HDBC.PostgreSQL it is looking at the local file
Database/HDBC/PostgreSQL.hs, and you cannot switch context to a module
that isn't yet loaded, hence the error.

If what you want is to load the package, then start in a different
directory so the local sources do not get in the way. If what you want
is to load the local sources then use :load (:l) rather than :module
(:m). The :load command loads local source files. The :module switches
context between loaded modules (modules from packages are already
loaded).

Duncan



More information about the Haskell-Cafe mailing list