module Observable:sig..end
An observable is a random function argument.
While random functions don't need to generate values of their arguments, they need the abilities to:
equal and hash, so that the same argument always returns
the same generated valueprint, in order to print the function implementation (bindings)
in case of test failureInspired by:
type -'a t
An observable of 'a, packing a printer and other things.
val make : ?eq:('a -> 'a -> bool) ->
?hash:('a -> int) -> 'a QCheck2.Print.t -> 'a tmake ?eq ?hash print creates an observable of 'a.
If eq is None, uses the standard polymorphic (=) function.
If hash is None, uses a default hashing function.
val equal : 'a t -> 'a -> 'a -> boolequal o returns the equality function of o.
val hash : 'a t -> 'a -> inthash o returns the hashing function of o.
val print : 'a t -> 'a QCheck2.Print.tprint o returns the printing function of o.
val unit : unit tunit is an observable of unit.
val bool : bool tbool is an observable of bool.
val int : int tint is an observable of int.
val float : float tfloat is an observable of float.
val bytes : bytes tbytes is an observable of bytes.
val string : string tstring is an observable of string.
val char : char tchar is an observable of char.
val contramap : ('b -> 'a) -> 'a t -> 'b tcontramap f o maps the function f on observable o.
Note the reverse order of types in f which may be
conter-intuitive: indeed a function that consumes values of type
'b can be obtained by transforming a value of type 'b to
'a using f, and then by consuming this value of type 'a using o.
val map : ('b -> 'a) -> 'a t -> 'b tQCheck2.Observable.contramap instead.val option : 'a t -> 'a option toption o wraps the observable o of 'a into an observable of
'a option.
val list : 'a t -> 'a list tlist o wraps the observable o of 'a into an observable of
'a list.
val array : 'a t -> 'a array tarray o wraps the observable o of 'a into an observable of
'a array.
val pair : 'a t ->
'b t -> ('a * 'b) tpair o1 o2 is an observable of pairs of ('a * 'b).
val triple : 'a t ->
'b t ->
'c t -> ('a * 'b * 'c) ttriple o1 o2 o3 is an observable of triples of ('a * 'b * 'c).
val quad : 'a t ->
'b t ->
'c t ->
'd t -> ('a * 'b * 'c * 'd) tquad o1 o2 o3 o4 is an observable of quadruples of ('a * 'b * 'c * 'd).