
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 GHCi, version 6.10.4: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer ... linking ... done. Loading package base ... linking ... done. Loading package HUnit-1.2.0.3 ... linking ... done. Loading package syb ... linking ... done. Loading package base-3.0.3.1 ... linking ... done. Loading package old-locale-1.0.0.1 ... linking ... done. Loading package old-time-1.0.0.2 ... linking ... done. Loading package random-1.0.0.1 ... linking ... done. Loading package QuickCheck-1.2.0.0 ... linking ... done. Loading package bytestring-0.9.1.4 ... linking ... done. Loading package array-0.2.0.0 ... linking ... done. Loading package containers-0.2.0.1 ... linking ... done. Loading package mtl-1.1.0.2 ... linking ... done. Loading package Win32-2.2.0.0 ... linking ... done. Loading package time-1.1.4 ... linking ... done. Loading package convertible-1.0.5 ... linking ... done. Loading package filepath-1.1.0.2 ... linking ... done. Loading package directory-1.0.0.3 ... linking ... done. Loading package process-1.0.1.1 ... linking ... done. Loading package haskell98 ... linking ... done. Loading package testpack-1.0.2 ... linking ... done. Loading package utf8-string-0.3.5 ... linking ... done. Loading package HDBC-2.1.1 ... linking ... done. Loading package parsec-2.1.0.1 ... linking ... done. Loading package HDBC-postgresql-2.1.0.0 ... linking ... done. Prelude> module HDBC HDBC.PostgreSQL Now I would think that the line "Loading package HDBC-postgresql-2.1.0.0 ... linking ... done." means that the module is installed correctly, but I still can't execute the :module statement. Does anyone have any ideas about where I should start? It's probably something stupid, but I'm a little worn out on searching. Thank you, Patrick

Patrick Brannan wrote:
Prelude> module HDBC HDBC.PostgreSQL
Now I would think that the line "Loading package HDBC-postgresql-2.1.0.0 ... linking ... done." means that the module is installed correctly, but I still can't execute the :module statement.
Does anyone have any ideas about where I should start? It's probably something stupid, but I'm a little worn out on searching.
That's because you're confusing package names with module names. I suspect you meant :m Database.HDBC Database.HDBC.PostgreSQL The API docs on Hackage will list the modules that any package provides. -- John

No, I was running the following:
:module Database.HDBC Database.HDBC.PostgreSQL
and the reply was:
module `Database.HDBC.PostgreSQL' is not loaded
Not sure where to go from here. I'll keep reading.
On Fri, Oct 9, 2009 at 4:58 PM, John Goerzen
Patrick Brannan wrote:
Prelude> module HDBC HDBC.PostgreSQL
Now I would think that the line "Loading package HDBC-postgresql-2.1.0.0 ... linking ... done." means that the module is installed correctly, but I still can't execute the :module statement.
Does anyone have any ideas about where I should start? It's probably something stupid, but I'm a little worn out on searching.
That's because you're confusing package names with module names.
I suspect you meant
:m Database.HDBC Database.HDBC.PostgreSQL
The API docs on Hackage will list the modules that any package provides.
-- John

Patrick Brannan
Prelude> :module Database.HDBC Database.HDBC.PostgreSQL module `Database.HDBC.PostgreSQL' is not loaded
I wonder if I haven't seen this when I'm in the package's top directory, that is, the current directory contains Database/HDBC/PostgreSQL.hs below it. Cd somewhere else and try again? % cd Work/biohaskell/biolib % ghci GHCi, version 6.10.4: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer ... linking ... done. Loading package base ... linking ... done. Prelude> :m Bio.Sequence module `Bio.Sequence' is not loaded Prelude> :cd / Prelude> :m Bio.Sequence Prelude Bio.Sequence> -k -- If I haven't seen further, it is by standing in the footprints of giants

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

That did the trick. Everything works perfectly now. Thank you.
On Sat, Oct 10, 2009 at 8:04 AM, Duncan Coutts
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
participants (4)
-
Duncan Coutts
-
John Goerzen
-
Ketil Malde
-
Patrick Brannan