QCheck.Iter
Iter
is compatible with the library "sequence". An iterator i
is simply a function that accepts another function f
(of type 'a -> unit
) and calls f
on a sequence of elements f x1; f x2; ...; f xn
.
The type of iterators, underlying Shrink.t
.
val empty : 'a t
The empty iterator
val return : 'a -> 'a t
The constant iterator
Applicative operator for iterators, combining a function iterator and an argument iterator into a result generator.
Monadic bind operator for iterators. i >>= f
passes each element of i
to f
, iterating over each element of f
's resulting iterators.
map f i
returns an iterator of elements from i
, each of which have been applied to f
.
map f i j
returns an iterator of elements from i
and j
, which have been applied to f
.
val of_list : 'a list -> 'a t
of_list xs
builds an iterator over the list elements of xs
.
val of_array : 'a array -> 'a t
of_array xs
builds an iterator over the array elements of xs
.
pair a b
iterates over pairs (x,y)
with x
coming from a
and y
coming from b
.
triple a b c
iterates over triples (x,y,z)
with x
coming from a
, y
coming from b
, and z
coming from c
.
quad a b c d
iterates over quadruples (x,y,z,w)
with x
coming from a
, y
coming from b
, z
coming from c
, and w
coming from d
.
val find : ('a -> bool) -> 'a t -> 'a option
find p i
maps over the iterator i
, returning Some _
when the predicate p
is true
and None
otherwise.
filter p i
returns an iterator of elements from i
satisfying p
.
Binding operator alias for map
.
Binding operator alias for pair
.
Binding operator alias for (>>=)
.
Binding operator alias for pair
.