package qcheck-core

  1. Overview
  2. Docs

Module QCheck.IterSource

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.

Sourcetype 'a t = ('a -> unit) -> unit

The type of iterators, underlying Shrink.t.

Sourceval empty : 'a t

The empty iterator

Sourceval return : 'a -> 'a t

The constant iterator

Sourceval (<*>) : ('a -> 'b) t -> 'a t -> 'b t

Applicative operator for iterators, combining a function iterator and an argument iterator into a result generator.

Sourceval (>>=) : 'a t -> ('a -> 'b t) -> 'b t

Monadic bind operator for iterators. i >>= f passes each element of i to f, iterating over each element of f's resulting iterators.

Sourceval map : ('a -> 'b) -> 'a t -> 'b t

map f i returns an iterator of elements from i, each of which have been applied to f.

Sourceval map2 : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t

map f i j returns an iterator of elements from i and j, which have been applied to f.

Sourceval (>|=) : 'a t -> ('a -> 'b) -> 'b t

An infix synonym for map.

Sourceval append : 'a t -> 'a t -> 'a t

append a b first iterates over a's elements and then over b's.

Sourceval (<+>) : 'a t -> 'a t -> 'a t

Synonym for append.

Sourceval of_list : 'a list -> 'a t

of_list xs builds an iterator over the list elements of xs.

Sourceval of_array : 'a array -> 'a t

of_array xs builds an iterator over the array elements of xs.

Sourceval pair : 'a t -> 'b t -> ('a * 'b) t

pair a b iterates over pairs (x,y) with x coming from a and y coming from b.

Sourceval triple : 'a t -> 'b t -> 'c t -> ('a * 'b * 'c) t

triple a b c iterates over triples (x,y,z) with x coming from a, y coming from b, and z coming from c.

Sourceval quad : 'a t -> 'b t -> 'c t -> 'd t -> ('a * 'b * 'c * 'd) t

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.

Sourceval 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.

Sourceval filter : ('a -> bool) -> 'a t -> 'a t

filter p i returns an iterator of elements from i satisfying p.

Sourceval append_l : 'a t list -> 'a t

Appends a list of iterators into a single iterator.

  • since 0.8
Sourceval flatten : 'a t t -> 'a t

Flattens an iterator of iterators into a single iterator.

  • since 0.8
Sourceval (let+) : 'a t -> ('a -> 'b) -> 'b t
Sourceval (and+) : 'a t -> 'b t -> ('a * 'b) t
Sourceval (let*) : 'a t -> ('a -> 'b t) -> 'b t
Sourceval (and*) : 'a t -> 'b t -> ('a * 'b) t
OCaml

Innovation. Community. Security.