[Haskell-cafe] Re: Generating repeatable arbitrary values with
QuickCheck 2
Sean Leather
leather at cs.uu.nl
Tue Feb 2 07:34:54 EST 2010
Correction about the latter part...
> In the end, I would write something like the following:
>
> unGen arbitrary (mkStdGen 11) 5 :: [Int]
>>
>
> This produces, for example, [5,1,-2,-4,2]. I also want to generate the same
> value for a type isomorphic to [Int].
>
> unGen arbitrary (mkStdGen 11) 5 :: List Int
>>
>
> Unfortunately, this produces Cons 4 (Cons 3 (Cons (-2) (Cons 0 (Cons (-1)
> Nil)))): same length but different values. The Arbitrary instances are the
> same.
The Arbitrary instance were _slightly_ different, but different enough. ;)
Now, the values are isomorphic. Thankfully, purity is restored.
Sean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100202/1f93e932/attachment.html
More information about the Haskell-Cafe
mailing list