2011-09-12 44 views
4

耶索德,我得到了以下錯誤:無法安裝使用「重複實例聲明」

cabal install rsa 
Resolving dependencies... 
Configuring RSA-1.0.6.1... 
Preprocessing library RSA-1.0.6.1... 
Preprocessing executables for RSA-1.0.6.1... 
Building RSA-1.0.6.1... 
[1 of 1] Compiling Codec.Crypto.RSA (Codec/Crypto/RSA.hs, dist/build/Codec/Crypto/RSA.o) 

Codec/Crypto/RSA.hs:577:10: 
    Duplicate instance declarations: 
     instance Random Word8 -- Defined at Codec/Crypto/RSA.hs:577:10-21 
     instance Random Word8 -- Defined in System.Random 
cabal: Error: some packages failed to install: 

這似乎與其他庫RSA LIB衝突。

有什麼想法?

我的環境: 的Mac OS X 10.7 GHC 7.0.3

在此先感謝。

+2

想了解更多的背景知識,如果我沒有弄錯,這就叫做[Orphan Instance](http://www.haskell.org/haskellwiki/Orphan_instance)問題。 – MatrixFrog

回答

5

random程序包開始在版本1.0.1.0中導出新實例。一種解決方案是僅在random包是該版本或更高版本時纔有條件地編譯RSA庫的實例;像這樣的一些變化應該工作:

{-# LANGUAGE CPP #-} 
#if MIN_VERSION_random(1,0,1) 
#else 
instance Random Word8 where 
    ... 
#endif 

如果您發送修補程序到RSA庫的維護者的獎勵點。

或者,您可以要求cabal使用舊版本random

+0

非常感謝。我使用舊版本的隨機工具。 –