runghc -package-db=.cabal-sandbox/.cabal-sandbox/x86_64-osx-ghc-7.8.3-packages.conf.d hellowai.hs
对我来说完美运作。
同样地,使用
ghci -package-db=.cabal-sandbox/.cabal-sandbox/x86_64-osx-ghc-7.8.3-packages.conf.d
我也能够在ghci
中轻松导入我的安装在cabal-sandbox中的Wai
包。
但是当我使用ghc-mod
验证我的Haskell源代码时,出现了问题:
ghc-mod check --boundary="" -g -package-db=.cabal-sandbox/x86_64-osx-ghc-7.8.3-packages.conf.d hellowai.hs
hellowai.hs:4:8:Could not find module ‘Network.Wai.Handler.Warp’Use -v to see a list of the files searched for.
hellowai.hs:3:8:Could not find module ‘Network.HTTP.Types’Perhaps you meant Network.HTTP.Base (from HTTP-4000.2.19) Network.HTTP.Base (needs flag -package HTTP-4000.2.10) Network.HTTP.Headers (needs flag -package HTTP-4000.2.10)Use -v to see a list of the files searched for.
hellowai.hs:2:8:Could not find module ‘Network.Wai’Perhaps you meant Network.BSD (needs flag -package network-2.4.2.3) Network.URI (needs flag -package network-2.4.2.3) Network.TCP (needs flag -package HTTP-4000.2.10)Use -v to see a list of the files searched for.
为什么无法找到我的cabal沙盒安装的模块?
.cabal
文件? - Calvin Cheng.cabal
文件,ghc-mod
仍然不知道在 cabal 沙盒中查找我的第三方包的位置。 - Calvin Chengcabal exec -- runghc hellowai.hs
是可行的(即能够找到沙箱)。 - Calvin Cheng