RWH 书籍说要获得 ByteString 支持,我需要添加:
instance Arbitrary B.ByteString where
arbitrary = fmap B.pack arbitrary
coarbitrary = coarbitrary . B.unpack
但是我的 GHC 7.2 和 QuickCheck 2.4.1.1 告诉我:
`coarbitrary' is not a (visible) method of class `Arbitrary'
有什么指点吗?
最佳答案
co Arbitary
已在 QC 2.0 中移至其自己的类型类 CoAbritary
,因此只需删除 coArbitary
的方程式即可。
另请参阅最新的 documentation .
关于Haskell QuickCheck2 使用 ByteString?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8113751/