[Haskell-cafe] class Arbitrary in quickcheck

Ozgur Akgun ozgurakgun at gmail.com
Wed May 5 08:57:13 EDT 2010


On 5 May 2010 11:38, Tim Docker <twd2 at dockerz.net> wrote:

> On 5 May 2010 09:01, Ozgur Akgun <ozgurakgun at gmail.com> wrote:
> >         your quick check property (in a different way of writing) is
> >         the following:
> >
> >         prop_1 :: Maybe Double -> Bool
> >         prop_1 v = v == v
>
> I think you misunderstood me. The property was fabricated just for
> the example.
>

OK that's possible :)


>
> My question was why, when I generate random values for (Maybe t, Maybe
> t) using the Arbitrary type class, do I always see two Nothing values
> or two Just values, and never one of each?
>
>
Let me try to understand you then. What happens when you run the following
command in ghci?

sample (arbitrary :: Gen (Maybe Int, Maybe Int) )

Do you still always get (Just _, Just _) or (Nothing, Nothing) pairs, or do
you also get some (Nothing, Just _) or (Just _, Nothing) pairs?

Ozgur
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100505/958ed8c6/attachment.html


More information about the Haskell-Cafe mailing list