No Arbitrary instances for fixed size integrals
Alexey Khudyakov
alexey.skladnoy at gmail.com
Sun Aug 29 09:34:04 EDT 2010
Hello
Recently I learned that fixed size integral types like Int8,Word8...
do not have Arbitrary instance. That's annoying when one need to work
with these types. So could you add such instances?
I wasn't able to find QuickCheck repository so I paste code for
instances inline instead of proper patch:
import Data.Word (Word8,Word16,Word32,Word64)
import Data.Int (Int8, Int16, Int32, Int64 )
instance Arbitrary Int8 where
arbitrary = arbitraryBoundedIntegral
instance Arbitrary Int16 where
arbitrary = arbitraryBoundedIntegral
instance Arbitrary Int32 where
arbitrary = arbitraryBoundedIntegral
instance Arbitrary Int64 where
arbitrary = arbitraryBoundedIntegral
instance Arbitrary Word8 where
arbitrary = arbitraryBoundedIntegral
instance Arbitrary Word16 where
arbitrary = arbitraryBoundedIntegral
instance Arbitrary Word32 where
arbitrary = arbitraryBoundedIntegral
instance Arbitrary Word64 where
arbitrary = arbitraryBoundedIntegral
More information about the QuickCheck
mailing list