Bugfix for QuickCheck 1.1.0.0

Patrick Perry patperry at stanford.edu
Tue Sep 2 12:46:36 EDT 2008


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?

Patrick
1
0
2
-2
0
0
0
0
2
-3
00
11
-3
-5
-9
05
06
17
-5
49
30
-1
-1
33
-8
-4
66
27
78
09
60
01
-8
83
-12
35
-4
13
38
-1
-4
-1
02
-10
-3
45
06
-10
-12
-4
20
-7
-18
-2
84
-10
-2
13
38
29
60
-6
12
20
-12
95
-8
-22
58
49
90
-12
12
-12
-1
-1
-14
-14
27
-1
00
01
-16
23
54
25
24
-15
48
14
-10
-37
02
-19
84
17
-15
-19
-1
42


-3
1
-3
1
3
-3
-4
-4
-2
-3
10
-1
02
43
14
05
-1
07
18
-1
-3
21
-4
-5
34
25
-1
17
18
-8
-4
31
13
53
64
95
06
27
-2
-6
60
10
72
-2
-3
45
36
-9
16
39
-4
01
27
-3
-22
-7
-4
-14
-1
-6
-8
-1
-23
-13
14
45
-24
17
-1
49
-5
25
-13
11
44
05
26
12
-12
-33
00
11
27
93
35
25
-3
-6
98
-12
-20
10
-11
43
34
12
-43
17
-3
09





More information about the Libraries mailing list