Base_quickcheck.ObserverObservers create random functions. Generator.fn creates a random function using an observer for the input type and a generator for the output type.
val opaque : _ t @@ portableProduces an observer that treats all values as equivalent. Random functions generated using this observer will be constant with respect to the value(s) it observes.
val string : Base.string tval bytes : Base.bytes tval int32 : Base.int32 tval int63 : Base.Int63.t tval int64 : Base.int64 tval nativeint : Base.nativeint tval float : Base.float tval sexp : Base.Sexp.t tval option : 'a. 'a t -> 'a Base.option tval or_null : 'a t -> 'a Base.or_null tval array : 'a t -> 'a Base.array tval lazy_t : 'a t -> 'a Base.Lazy.t tval either : 'a 'b. 'a t -> 'b t -> ('a, 'b) Base.Either.t tval result : 'a 'b. 'a t -> 'b t -> ('a, 'b) Base.Result.t tThis helper module type exists separately just to open Bigarray in its scope.
val bigstring :
(Base.char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
tval float32_vec :
(Base.float, Bigarray.float32_elt, Bigarray.fortran_layout) Bigarray.Array1.t
tval float64_vec :
(Base.float, Bigarray.float64_elt, Bigarray.fortran_layout) Bigarray.Array1.t
tval float32_mat :
(Base.float, Bigarray.float32_elt, Bigarray.fortran_layout) Bigarray.Array2.t
tval float64_mat :
(Base.float, Bigarray.float64_elt, Bigarray.fortran_layout) Bigarray.Array2.t
tval fn : 'a 'b. 'a Generator.t -> 'b t -> ('a -> 'b) t @@ portableProduces an observer that generates random inputs for a given function, calls the function on them, then observes the corresponding outputs.
val map_t : 'key t -> 'data t -> ('key, 'data, 'cmp) Base.Map.t t @@ portableval set_t : 'elt t -> ('elt, 'cmp) Base.Set.t t @@ portableval map_tree :
'key t ->
'data t ->
('key, 'data, 'cmp) Base.Map.Using_comparator.Tree.t t @@ portableval set_tree :
'elt t ->
('elt, 'cmp) Base.Set.Using_comparator.Tree.t t @@ portableval of_hash_fold :
(Base.Hash.state -> 'a -> Base.Hash.state) ->
'a t @@ portableCreates an observer that just calls a hash function. This is a good default for most hashable types not covered by the basic observers above.
Ties the recursive knot to observe recursive types.
For example, here is an observer for binary trees:
let tree_observer leaf_observer =
fixed_point (fun self ->
either leaf_observer (both self self)
|> unmap ~f:(function
| `Leaf leaf -> First leaf
| `Node (l, r) -> Second (l, r)))
;;val of_lazy : 'a t Base.Lazy.t -> 'a t @@ portableCreates a t that forces the lazy argument as necessary. Can be used to tie (mutually) recursive knots.
val of_portable_lazy : 'a t Base.Portable_lazy.t -> 'a t @ portable @@ portableLike of_lazy, but for Portable_lazy.t.
Most users do not need to call these functions.
val create :
('a -> size:Base.int -> hash:Base.Hash.state -> Base.Hash.state) ->
'a t @@ portableval observe :
'a t ->
'a ->
size:Base.int ->
hash:Base.Hash.state ->
Base.Hash.state @@ portablemodule Via_thunk : sig ... end