PostgreSQL"找不到模块"

时间:2015-07-04 12:58:47

标签: haskell package cabal

我尝试使用Posgres和cabal沙箱进行新项目。我安装了postgresql-simple,安装输出证明了这一点:

$ cabal install postgresql-simple
Resolving dependencies...
All the requested packages are already installed:
postgresql-simple-0.4.10.0
Use --reinstall if you want to reinstall anyway.
Notice: installing into a sandbox located at
/Users/inaimathi/projects/hs-test/.cabal-sandbox

但是当我尝试在ghci中导入库时,我收到错误

ghci
GHCi, version 7.10.1: http://www.haskell.org/ghc/  :? for help
Prelude> import Database.PostgreSQL.Simple
import Database.PostgreSQL.Simple

<no location info>:
    Could not find module ‘Database.PostgreSQL.Simple’
    It is not a module in the current program, or in any known package.
Prelude> 

有谁可以指出我做错了什么?

1 个答案:

答案 0 :(得分:1)

您需要使用指向-package-db=...

/Users/inaimathi/projects/hs-test/.cabal-sandbox标记启动GHCi

所以 ghci -package-db=/Users/inaimathi/projects/hs-test/.cabal-sandbox 或者左右......