tl; dr:用cabal沙箱安装库,ghci仍然抱怨库丢失了
我有一个目录,我正在开发一些Haskell的东西.这曾经在ghc 7.6的另一台计算机上正常工作,但现在我正在使用ghc 7.8.2在另一台计算机上工作(我不知道版本是否重要)我得到这样的错误:
前奏>:l Interpreter.hs
Parser.hs:9:8:找不到模块'Text.ParserCombinators.Parsec'也许你的意思是Text.ParserCombinators.ReadPrec(来自基地)Text.ParserCombinators.ReadP(来自基地)使用-v查看文件列表搜索.
当试图从ghci加载文件时.这些文件位于BASE/src/Lib中,其中BASE是具有LIB.cabal的目录以及所有这些文件.所以我认为有一些东西与cabal.为了避免可怕的'阴谋地狱',我在项目(cabal sandbox init)中制作了一个沙箱,我以前没用过.然后我手动删除了其他与cabal相关的东西并且做了cabal init.我做了cabal install --dependencies-only,但实际上没有安装任何东西(我猜是因为 - 依赖 - 只是?我太偏执于全局安装使用常规cabal安装).所以我尝试手动添加东西到我的.cabal文件(你应该怎么做?),即:
建立,取决于:
base> = 4.7 && <4.8,
Run Code Online (Sandbox Code Playgroud)containers >=0.5 && <0.6, -- parsec == 3.1.* -- THIS is the line I added
现在我做到了cabal install --dependencies-only.瞧,实际安装的东西,特别是:
[21 of 25]编译Text.Parsec(Text/Parsec.hs,dist/dist-sandbox-a2fe5095/build /Text/Parsec.o)
...
就地注册parsec-3.1.5 ...在/ home/PATHTODIR/Stack中安装库Lang/.cabal-sandbox/lib/x86_64-linux-ghc-7.8.2/parsec-3.1.5注册parsec-3.1. 5 ...已安装parsec-3.1.5
所以我试着在ghci中加载相同的文件,产生相同的错误.请注意,问题是Text.ParserCombinators.Parsec,根据我的运行时间似乎安装得很好cabal install --dependencies-only.这是我得到的输出ghc -v Interpreter.hs:
格拉斯哥Haskell编译器,版本7.8.2,第2阶段由GHC版本7.4.1启动
使用二进制包数据库:/opt/ghc/7.8.2/lib/ghc-7.8.2/package.conf.d/package.cache
有线包ghc-prim映射到ghc-prim-0.3.1.0-948744e1f99cc8bcc7c7d3ba60c7c2d8
有线输入包integer-gmp映射到integer-gmp-0.5.1.0-dc47f6b546fc171f67a7f7d311684a99
有线封装基址映射到base-4.7.0.0-018311399e3b6350d5be3a16b144df9b
有线包rts映射到builtin_rts
有线包模板-haskell映射到template-haskell-2.9.0.0-
dcc8c210fb02937e104bc1784d7b0f06
找不到有线包dph-seq.
未找到有线包dph-par.
Hsc静态标志:
有线包ghc-prim映射到ghc-prim-0.3.1.0-948744e1f99cc8bcc7c7d3ba60c7c2d8
有线输入包integer-gmp映射到integer-gmp-0.5.1.0-
dc47f6b546fc171f67a7f7d311684a99
有线封装基址映射到base-4.7.0.0-018311399e3b6350d5be3a16b144df9b
有线包rts映射到builtin_rts
有线包模板-haskell映射到template-haskell-2.9.0.0-
dcc8c210fb02937e104bc1784d7b0f06
找不到有线包dph-seq.
未找到有线包dph-par.
*追逐依赖:
追逐以下模块:*Interpreter.hs
Parser.hs:9:8:找不到模块'Text.ParserCombinators.Parsec'也许你的意思是Text.ParserCombinators.ReadPrec(来自基地)Text.ParserCombinators.ReadP(来自基地)搜索的地点:Text/ParserCombinators/Parsec.hs文/ ParserCombinators/Parsec.lhs
Parser.hs:10:18:找不到模块'Text.Parsec.Token'搜索的位置:Text/Parsec/Token.hs Text/Parsec/Token.lhs
Interpreter.hs:11:8:找不到模块'Control.Monad.Error'也许你的意思是Control.Monad.Fix(来自基地)Control.Monad.ST(来自基地)Control.Monad.Zip(来自基地)地点搜索:Control/Monad/Error.hs Control/Monad/Error.lhs
Interpreter.hs:15:8:找不到模块'Text.ParserCombinators.Parsec.Error'搜索的位置:Text/ParserCombinators/Parsec/Error.hs Text/ParserCombinators/Parsec/Error.lhs *删除临时文件:删除:*删除临时目录:删除:
Rom*_*aka 11
ghc/ghci不会自动识别沙箱.默认情况下,它们仅查看全局和用户包数据库.
要么使用cabal repl启动ghci,要么关注我的文章cabal沙箱提示中的收件人.两者都可能需要最近(1.18之后)的阴谋集团.
| 归档时间: |
|
| 查看次数: |
1593 次 |
| 最近记录: |