Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Monolith.Gen
SourceThe submodule Gen
offers facilities for generating values of many common types. It draws data from the file whose name is supplied on the command line. (If no file name is supplied, it draws random data from OCaml's Random
module.)
A generator is a function of unit to a value of some desired type 'a
. It is permitted for a generator to fail by calling reject
or guard
. This failure is not fatal; it causes the engine to backtrack (to an unspecified point) and retry.
guard b
fails if b
is false.
int n
generates an integer in the semi-open interval [0..n)
. If this interval is empty, the generator fails.
interval i j
generates an integer in the semi-open interval [i, j)
. If this interval is empty, the generator fails.
interval_ i j
generates an integer in the closed interval [i, j]
. If this interval is empty, the generator fails.
sequential()
produces a fresh stateful sequential generator of integers. This generator is deterministic. Every time this generator is invoked, it produces a new integer, counting from 0 and up.
choose xs
picks an element in the list xs
. If this list is empty, the generator fails.
An option generator. If element
is an element generator, then option element
is a generator of optional elements.
A list generator. If element
is an element generator and if n
is a length generator (where a length is a nonnegative integer), then list n element
is a list generator.