RWH书籍说要获得ByteString支持,我需要添加:

instance Arbitrary B.ByteString where
    arbitrary   = fmap B.pack arbitrary
    coarbitrary = coarbitrary . B.unpack

但是我的带有QuickCheck 2.4.1.1的GHC 7.2告诉我:
`coarbitrary' is not a (visible) method of class `Arbitrary'

有指针吗?

最佳答案

coarbitrary在QC 2.0中已移至它自己的类型类CoAbritary,因此只需删除coarbitrary的方程式即可。

另请参阅最新的documentation

10-08 02:58