[Haskell-cafe] Bug with QuickCheck 1.1 and GHC 6.8.2
Johan Tibell
johan.tibell at gmail.com
Thu Aug 14 07:57:33 EDT 2008
On Thu, Aug 14, 2008 at 12:15 PM, Patrick Perry <patperry at stanford.edu> wrote:
> Actually, a much better solution is:
>
> variant :: Int -> Gen a -> Gen a
> variant v (Gen m) = Gen (\n r -> m n (rands r v))
> where
> rands r0 0 = r0
> rands r0 n = let (r1,r2) = split r0
> (n',s) = n `quotRem` 2
> in case s of
> 0 -> rands r1 n'
> _ -> rands r2 n'
It's not really clear to me how this works. Could you please explain?
Cheers,
Johan
More information about the Haskell-Cafe
mailing list