QCheck2.ObservableAn 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:
make ?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 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.
contramap 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.
option o wraps the observable o of 'a into an observable of 'a option.
triple o1 o2 o3 is an observable of triples of ('a * 'b * 'c).