在cabal testpack安装期间随机Word8重复实例声明

时间:2014-10-29 16:45:42

标签: haskell cabal cabal-install hunit

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

我已经尝试过谷歌搜索,但无法理解这个安装错误。

1 个答案:

答案 0 :(得分:2)

testpack-2.1.1Random Word8提供了一个所谓的 orphan 实例,也就是说,它没有定义类或类型本身的实例。

孤立实例的几个问题之一是定义类或类型的一个包可能会选择在更高版本中自己添加该实例,这正是{{在这种情况下,包已完成,因此实例发生冲突。

random版本testpack进行检查,确保仅在2.1.2包太旧而无法自行完成时才定义实例。因此,您应该可以通过安装更高版本的random来解决此问题。