当 cabal install testpack-2.1.1
失败时,以下错误消息意味着什么:
... Everything above this succeeded with no problems.
[22 of 22] Compiling Control.Monad.Cont ( Control/Monad/Cont.hs, dist/build/Control/Monad/Cont.o )
Registering mtl-2.2.1...
Installing library in /home/ely/.cabal/lib/mtl-2.2.1/ghc-7.4.2
Registering mtl-2.2.1...
Downloading testpack-2.1.1...
Configuring testpack-2.1.1...
Building testpack-2.1.1...
Preprocessing library testpack-2.1.1...
[1 of 3] Compiling Test.QuickCheck.Instances ( src/Test/QuickCheck/Instances.hs, dist/build/Test/QuickCheck/Instances.o )
src/Test/QuickCheck/Instances.hs:50:10:
Duplicate instance declarations:
instance Random Word8
-- Defined at src/Test/QuickCheck/Instances.hs:50:10
instance Random Word8 -- Defined in `System.Random'
cabal: Error: some packages failed to install:
testpack-2.1.1 failed during the building phase. The exception was:
ExitFailure 1
我尝试过谷歌搜索,但无法理解此安装错误。
最佳答案
testpack-2.1.1
为 Random Word8
提供了一个所谓的孤儿实例,即它没有定义的实例类或类型本身。
孤儿实例的几个问题之一是定义类或类型的包之一可能会选择在更高版本中添加该实例本身,这正是 >random
包在本例中已完成,因此实例发生冲突。
从testpack
版本2.1.2
开始,有一项检查确保仅在random
包太旧而无法定义实例时自己也这样做了。因此,您应该能够通过安装更高版本的 testpack
来解决此问题。
关于haskell - cabal 测试包安装期间随机 Word8 重复实例声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26636110/