Arbitrary Word64 for running tests on amd64

Copied from Arbitrary Word8; I don't understand the coarbitrary definition and
the Word64 one may be erroneous, but Properties.hs now compiles and passes all
tests.
This commit is contained in:
Alec Berryman
2007-04-19 10:46:52 +00:00
parent e2d5bf05c8
commit ba97db3f87

View File

@@ -193,6 +193,14 @@ instance Arbitrary Word8 where
arbitrary = choose (minBound,maxBound)
coarbitrary n = variant (fromIntegral ((fromIntegral n) `rem` 4))
instance Random Word64 where
randomR = integralRandomR
random = randomR (minBound,maxBound)
instance Arbitrary Word64 where
arbitrary = choose (minBound,maxBound)
coarbitrary n = variant (fromIntegral ((fromIntegral n) `rem` 4))
integralRandomR :: (Integral a, RandomGen g) => (a,a) -> g -> (a,g)
integralRandomR (a,b) g = case randomR (fromIntegral a :: Integer,
fromIntegral b :: Integer) g of