Fun.GenericGeneric functions.
See the generic function template to write your own.
module Fmt : sig ... endCustom pp function metadata key.
val pp : 'a Type.Gist.t -> Stdlib.Format.formatter -> 'a -> unitpp g ppf v formats v as described by g on ppf with a pseudo OCaml syntax similar to what you would see in the OCaml toplevel (REPL).
Warning. For the time being the output format should not be considered stable, it may change between minor versions of the library. Do not snapshot test these outputs in public CI runs like the opam repository.
Overriding. The function can be selectively overriden on a gist or a field with the Fmt metadata key. This happens before ignoring (see below).
Ignoring. Gists or fields whose Type.Gist.Meta.Ignore metadata key is true are not printed. If you want a gist or field to be ignored only for the purpose of printing you can override pp with Fmt.ignore in the metadata.
module Equal : sig ... endCustom equal function metadata key.
val equal : 'a Type.Gist.t -> 'a -> 'a -> boolequal g v0 v1 determines the equality of values v0 and v1 as described by g.
Overriding. The function can be selectively overriden on a gist or a field with the Equal metadata key. This happens before ignoring (see below).
Ignoring. Gists or fields whose Type.Gist.Meta.Ignore metadata key is true are ignored for determining equality (the comparison returns true). If you want a gist or field to be ignored only for the purpose of equality checking you can override equal with Equal.ignore in the metadata.
Undefined. Unless ignored (see above), the function raises Invalid_argument in these cases:
v0 and v1 return different Type.Gist.Abstract.version_index.module Compare : sig ... endCustom compare function metadata key.
val compare : 'a Type.Gist.t -> 'a -> 'a -> intcompare g v0 v1 compares values v0 and v1 as described by g.
Overriding. The function can be selectively overriden on a gist or field with the Compare metadata key. This happens before ignoring (see below).
Ignoring. Gists or fields whose Type.Gist.Meta.Ignore metadata key is true are ignored by the comparison (the comparison returns 0). If you want a gist or field to be ignored only for the purpose of comparison you can override compare with Compare.ignore in the metadata.
Undefined. Unless ignored (see above), the function raises Invalid_argument in these cases:
v0 and v1 return different Type.Gist.Abstract.version_index.module Random : sig ... endCustom random function and sizing metadata keys.
val random :
'a Type.Gist.t ->
?size:int ->
?state:Stdlib.Random.State.t ->
unit ->
'arandom g ~state () generates a random value described by g with:
state, the random state to start from, defaults to Random.State.make_self_init.size, an indicative, strictly positive, size factor to let users control an upper bound on the size and complexity of generated values (defaults to 23). It should be used by generators to proportionally bound the length of sequences or the number of nodes in trees. It can be altered by gists and fields via the Random.Size key.Warning. For the time being the generation should not be considered stable, it may change between minor versions of the library.
Overriding. The function can be selectively overriden on a gist or field with the Random.Gen metadata key. The sizing factor can also be for a given gist or field by using the Random.Size metadata key.
Undefined. Unless overriden with a Random.Gen.const constant value the function raises Invalid_argument in these cases: