Haskell QuickCheck2 using ByteString?

假装没事ソ 提交于 2019-11-30 23:40:24

问题


The RWH books says that to get ByteString support, I need to add:

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

But my GHC 7.2 with QuickCheck 2.4.1.1 tells me:

`coarbitrary' is not a (visible) method of class `Arbitrary'

Any pointers?


回答1:


coarbitrary has moved to it's own typeclass CoAbritary in QC 2.0, so simply just remove the equation for coarbitrary.

Also see the latest documentation.



来源:https://stackoverflow.com/questions/8113751/haskell-quickcheck2-using-bytestring

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!