Bugfix for QuickCheck

Jed Brown jed at 59A2.org
Tue Sep 2 13:52:32 EDT 2008

On Tue 2008-09-02 09:46, Patrick Perry wrote:
> Jed Brown wrote:
>> The idea with QC is that you start with `simple' random input and
>> progress to more `complicated' input.  If say, you are testing a
>> function that builds a list with length equal to the output of the
>> QC-generated function (Double->Int) (with positive precondition) you
>> could be building a huge list very early.  This wouldn't happen with
>> other types since `simple' QC-generated functions for, say, (Int->Int)
>> will map small integers to small integers.
> I don't think this has anything to do with the definition of  
> coarbitrary.  As I understand things:
> coarbitrary is a function of type x -> StdGen
> arbitrary is a function of type StdGen -> Int -> x
> For the type "x -> y", arbitrary is equal to
> \g n -> (\x -> let g' = coarbitrary x in arbitrary g' n)
> I did an experiment in QC1 (with patch).  Here are two properties:
> prop_f (f :: Double -> Int) x = trace (show $ f x) True
> prop_g (f :: Int -> Int) x = trace (show $ f x) True
> Below is the output.  Do you think that one is "more simple" than the  
> other?

Hmm, I guess I should have run the test before speculating.  It looks
like the logarithmic factor keeps it all in control.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/libraries/attachments/20080902/bc3df45f/attachment.bin

More information about the Libraries mailing list