PostgreSQL "Could not find module"

PostgreSQL "Could not find module"

我正在尝试将 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> 

谁能指出我做错了什么?

您需要使用指向 /Users/inaimathi/projects/hs-test/.cabal-sandbox

-package-db=... 标志启动 GHCi

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