type -'a t = 'a Base_quickcheck.Observer.t
val create : ('a -> size:Base.Int.t -> hash:Base.Hash.state -> Base.Hash.state) -> 'a tval observe : 'a t -> 'a -> size:Base.Int.t -> hash:Base.Hash.state -> Base.Hash.stateval of_hash : (module Quickcheck_intf.Deriving_hash with type t = 'a) -> 'a tof_hashcreates an observer for any hashable type.
val bool : Base.Bool.t tval char : Base.Char.t tval doubleton : ('a -> Base.Bool.t) -> 'a tdoubleton fmaps values to two "buckets" (as described intabove), depending on whether they satisfyf.
val enum : Base.Int.t -> f:('a -> Base.Int.t) -> 'a tenum n ~fmaps values tonbuckets, wherefproduces the index for a bucket from0ton-1for each value.
val of_list : 'a Base.List.t -> equal:('a -> 'a -> Base.Bool.t) -> 'a tof_list list ~equalmaps values inlistto separate buckets, and compares observed values to the elements oflistusingequal.
val fixed_point : ('a t -> 'a t) -> 'a tFixed point observer for recursive types. For example:
let sexp_obs = fixed_point (fun sexp_t -> unmap (variant2 string (list sexp_t)) ~f:(function | Sexp.Atom atom -> `A atom | Sexp.List list -> `B list))
val variant2 : 'a t -> 'b t -> [ `A of 'a | `B of 'b ] tval variant3 : 'a t -> 'b t -> 'c t -> [ `A of 'a | `B of 'b | `C of 'c ] tval variant4 : 'a t -> 'b t -> 'c t -> 'd t -> [ `A of 'a | `B of 'b | `C of 'c | `D of 'd ] tval variant5 : 'a t -> 'b t -> 'c t -> 'd t -> 'e t -> [ `A of 'a | `B of 'b | `C of 'c | `D of 'd | `E of 'e ] tval variant6 : 'a t -> 'b t -> 'c t -> 'd t -> 'e t -> 'f t -> [ `A of 'a | `B of 'b | `C of 'c | `D of 'd | `E of 'e | `F of 'f ] tval of_predicate : 'a t -> 'a t -> f:('a -> Base.Bool.t) -> 'a tof_predicate t1 t2 ~fcombinest1andt2, wheret1observes values that satisfyfandt2observes values that do not satisfyf.
val comparison : compare:('a -> 'a -> Base.Int.t) -> eq:'a -> lt:'a t -> gt:'a t -> 'a tcomparison ~compare ~eq ~lt ~gtcombines observersltandgt, whereltobserves values less thaneqaccording tocompare, andgtobserves values greater thaneqaccording tocompare.
val singleton : Base.Unit.t -> _ tmaps all values to a single bucket.
val unmap : 'a t -> f:('b -> 'a) -> 'b tunmap t ~fappliesfto values before observing them usingt.
val tuple2 : 'a t -> 'b t -> ('a * 'b) tval tuple3 : 'a t -> 'b t -> 'c t -> ('a * 'b * 'c) tval tuple4 : 'a t -> 'b t -> 'c t -> 'd t -> ('a * 'b * 'c * 'd) tval tuple5 : 'a t -> 'b t -> 'c t -> 'd t -> 'e t -> ('a * 'b * 'c * 'd * 'e) tval tuple6 : 'a t -> 'b t -> 'c t -> 'd t -> 'e t -> 'f t -> ('a * 'b * 'c * 'd * 'e * 'f) tval fn : 'a Base_quickcheck.Generator.t -> 'b t -> ('a -> 'b) tObserver for function type.
fn gen tobserves a function by generating random inputs fromgen, applying the function, and observing the output usingt.
val of_fun : (Base.Unit.t -> 'a t) -> 'a tof_fun fproduces an observer that lazily appliesf.It is recommended that
fshould not do a lot of expensive work and should not be memoized. Instead, spread out the work of generating an observer over manyof_funcalls combined with, e.g.,variantortuple. This allows lazily generated observers to be garbage collected after each test and the relevant portions cheaply recomputed in subsequent tests, rather than accumulating without bound over time.