'镜头'的cabal依赖解析失败

时间:2014-05-07 06:23:31

标签: haskell cabal

我刚刚进行了一次更新并试图安装镜头'来自hackage。这给了我以下错误 -

$ cabal install -j lens
Resolving dependencies...
Configuring dlist-0.7.0.1...
... <snip>
Configuring mtl-2.0.1.0...
Building mtl-2.0.1.0...
Failed to install mtl-2.0.1.0
Last 10 lines of the build log ( /home/aj/.cabal/logs/mtl-2.0.1.0.log ):
Building mtl-2.0.1.0...
Preprocessing library mtl-2.0.1.0...
[ 1 of 21] Compiling Control.Monad.Writer.Class (
Control/Monad/Writer/Class.hs, dist/build/Control/Monad/Writer/Class.o )
[ 2 of 21] Compiling Control.Monad.State.Class ( Control/Monad/State/Class.hs,
dist/build/Control/Monad/State/Class.o )
[ 3 of 21] Compiling Control.Monad.Reader.Class (
Control/Monad/Reader/Class.hs, dist/build/Control/Monad/Reader/Class.o )
[ 4 of 21] Compiling Control.Monad.RWS.Class ( Control/Monad/RWS/Class.hs,
dist/build/Control/Monad/RWS/Class.o )
[ 5 of 21] Compiling Control.Monad.Identity ( Control/Monad/Identity.hs,
dist/build/Control/Monad/Identity.o )
[ 6 of 21] Compiling Control.Monad.Error.Class ( Control/Monad/Error/Class.hs,
dist/build/Control/Monad/Error/Class.o )
Control/Monad/Error/Class.hs:93:18: Not in scope: `catch'
... <snip>
cabal: Error: some packages failed to install:
aeson-0.7.0.3 depends on mtl-2.0.1.0 which failed to install.
exceptions-0.6 depends on mtl-2.0.1.0 which failed to install.
free-4.7.1 depends on mtl-2.0.1.0 which failed to install.
lens-4.1.2 depends on mtl-2.0.1.0 which failed to install.
mtl-2.0.1.0 failed during the building phase. The exception was:
ExitFailure 1

看起来mtl-2.0.1.0已经破了。然而,一些更多的依赖性跟踪揭示镜头包定义中的任何内容实际上都不依赖于mtl的那个版本。事实上,我尝试的下一件事是 -

$ cabal install -j aeson
$ cabal install -j free
$ cabal install -j lens

成功没有问题。

那么为什么cabal会在直接安装mtl-2.0.1.0时尝试安装lens?我尝试删除我的.ghc和.cabal目录并重复这些步骤,结果相同。我使用的电缆版本是1.16 -

$ cabal -V
cabal-install version 1.16.0.2
using version 1.16.0 of the Cabal library 

2 个答案:

答案 0 :(得分:1)

我使用的解决方法是首先安装变压器 - compat with transformers 3 flag

$ cabal install -ftransformer3 transformers-compat

然后安装带变压器0.3.0.0约束的镜头

$ cabal install --constraint="transformers==0.3.0.0" lens

答案 1 :(得分:0)

我也反对这个错误。我想我已经设法通过手动解压mtl-2.0.1.0来修复它,明确地将catch添加到Control.Exception中的Control/Monad/Error/Class.hs的导入列表中(L:55),然后运行cabal install

之后我能够运行cabal install lens。我很想知道这是否也适合你!