Module Tpf_qcheck

Generic QCheck.arbitrary.

Note that if your type has interesting recursion, this will probably not work as it is not possible to fixpoint through arbitrary.

Most of the work here is being done by Tpf_std.Random and Tpf_fmt, which you can use directly if this is the case.

Generic arbitrary

include Tpf.P with type 'a q := 'a QCheck.arbitrary
type 'a q

Query type.

type p

q proxy.

val (!) : 'a q -> ('ap) Tpf.app

Injection.

val g_arb : ('ap) Tpf.view -> ('ap) Tpf.schema -> ?⁠base:'a -> int -> 'a QCheck.arbitrary

g_arb view schema ~base size is the arbitrary instance over 'a.

base and size are used by Tpf_std.Random.g_gen to bound the recursion depth.

data interface

include Tpf.Data with type 'a q := 'a QCheck.arbitrary and type 'a r := ?⁠base:'a -> int -> 'a QCheck.arbitrary
type 'a q

The query type.

This is what we need at each inner type that we encounter.

type 'a r

The overall result type.

It's often the same as q, but it doesn't have to be.

val data0 : 'x Tpf.data0 -> 'x r
val data1 : ('a'x) Tpf.data1 -> 'a q -> 'x r
val data2 : ('a'b'x) Tpf.data2 -> 'a q -> 'b q -> 'x r
val data3 : ('a'b'c'x) Tpf.data3 -> 'a q -> 'b q -> 'c q -> 'x r
val data4 : ('a'b'c'd'x) Tpf.data4 -> 'a q -> 'b q -> 'c q -> 'd q -> 'x r
val data5 : ('a'b'c'd'e'x) Tpf.data5 -> 'a q -> 'b q -> 'c q -> 'd q -> 'e q -> 'x r
val data6 : ('a'b'c'd'e'f'x) Tpf.data6 -> 'a q -> 'b q -> 'c q -> 'd q -> 'e q -> 'f q -> 'x r
val data7 : ('a'b'c'd'e'f'g'x) Tpf.data7 -> 'a q -> 'b q -> 'c q -> 'd q -> 'e q -> 'f q -> 'g q -> 'x r
val data8 : ('a'b'c'd'e'f'g'h'x) Tpf.data8 -> 'a q -> 'b q -> 'c q -> 'd q -> 'e q -> 'f q -> 'g q -> 'h q -> 'x r
val data9 : ('a'b'c'd'e'f'g'h'i'x) Tpf.data9 -> 'a q -> 'b q -> 'c q -> 'd q -> 'e q -> 'f q -> 'g q -> 'h q -> 'i q -> 'x r