Module Stateful_gen.Default

include Monad.S
include Applicative.S
include Functor.S
type 'a t
val map : ('a -> 'b) -> 'a t -> 'b t

Map over the given value.

val return : 'a -> 'a t

Inject the given value.

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

Map a binary function over the given value.

val product : 'a t -> 'b t -> ('a * 'b) t

Combine the given values. See also map2.

val join : 'a t t -> 'a t

Monadic join operator.

val bind : 'a t -> ('a -> 'b t) -> 'b t

Monadic bind operator.

type 'a m = 'a Identity.t
val bool : bool t

Generate a bool.

val nat_less_than : int -> int t

Generate a nat smaller than the given value.

val small_int : int t

Generate a small int.

val replicate : int -> 'a t -> 'a list t

Generate a list of the given length.

val replicate_for_each : 'a list -> 'b t -> ('a * 'b) list t

Run a predetermined generator for each element in a list, and combine the result with the list element.

See traverse for a more general form.

val traverse : ('a -> 'b t) -> 'a list -> 'b list t

Produce a generator for each element in a list.

val oneof : 'a t Non_empty.t -> 'a t

Return a generator that picks and invokes one of the given generators, uniformly distributed.

val small_list : 'a t -> 'a list t

Generate a short list.

val opt : 'a t -> 'a option t

Generate an optional value.

val char_readable : char t

Generate a readable character.

val string_readable : string t

Generate a readable string.

val lift : 'a m -> 'a t

Lift the underlying computation type into a generator.

val to_qcheck_gen : 'a t -> 'a m QCheck.Gen.t

Convert a QCheck_extra generator to a QCheck generator.

The QCheck generator is run once once and the result is used as the seed of the given generator.

Warning Because Stdlib.Random.Gen and QCheck.Gen have mutable state, you must make sure this is only called once, to get predictable results.