[Haskell-cafe] Bug with QuickCheck 1.1 and GHC 6.8.2

Patrick Perry patperry at stanford.edu
Wed Aug 13 19:58:53 EDT 2008


The bug is in the "variant" function in QuickCheck.  I replaced

variant :: Int -> Gen a -> Gen a
variant v (Gen m) = Gen (\n r -> m n (rands r !! (v+1))
  where
   rands r0 = r1 : rands r2 where (r1, r2) = split r0

with

variant :: Int -> Gen a -> Gen a
variant v (Gen m) = Gen (\n r -> m n (rands r !! v'))
  where
   v' = abs (v+1) `mod` 10000
   rands r0 = r1 : rands r2 where (r1, r2) = split r0

and now everything works fine.  "10000" seems like a reasonable value  
here, but one could hard-code a lower or higher value as well.

Can someone make sure this gets fixed in the next version of  
QuickCheck?  I'm not sure who the maintainer is.


Patrick



More information about the Haskell-Cafe mailing list