[Haskell-cafe] class Arbitrary in quickcheck

Tim Docker twd2 at dockerz.net
Wed May 5 03:47:02 EDT 2010


I've notice a behaviour of quickcheck that is unexpected to me. With
this code:

import Test.QuickCheck

main = check myconfig 
     ((\v -> v == v) :: (Maybe Double,Maybe Double) -> Bool)

myconfig = defaultConfig{configMaxTest=100000,
                         configEvery = \n args -> show n ++ ":\n"
                                                  ++ unlines args}

I am relying on the default Arbitrary instances to generate pairs of
maybe doubles. But to my surprise, all of the pairs have these patterns:

    (Just _ Just _)
    (Nothing, Nothing)

I never see patterns:

    (Just _, Nothing)
    (Nothing, Just _)

Why is this the case?

Thanks,

Tim








More information about the Haskell-Cafe mailing list