package ppx_deriving_qcheck

  1. Overview
  2. Docs
type 'a nested_pairs =
  1. | Pair of 'a nested_pairs * 'a nested_pairs
  2. | Double of 'a * 'a
  3. | Simple of 'a
val nest_generators : Ppxlib.expression list -> Ppxlib.expression nested_pairs

Takes a list of expression and nest them into pairs, in order to be used with QCheck.pair combinator

example: nest_generators a => a nest_generators a;b => Double a b nest_generators a;b;c => Pair (Simple a) (Double b c) nest_generators a;b;c;d => Pair (Double a b) (Double c d)

Transforms nested pairs of expressions into an expression using QCheck.pair combinator

val nested_pairs_to_list : 'a nested_pairs -> 'a list

Transforms nested pairs of 'a into a list of 'a, roundtrip with nest_generators

val names_from_gens : (string -> string) -> 'a nested_pairs -> string nested_pairs

names_from_gens f gens creates unique name for the gens

The name is created using f applied on the fresh integer identifier

val pattern_from_gens : Ppxlib.location -> (string -> string) -> 'a nested_pairs -> Ppxlib.pattern * string nested_pairs

patterns_from_gens loc f gens creates a pattern from gens, it also returns the generators names from names_from_gens f gens in order to be used afterward

OCaml

Innovation. Community. Security.