package ppx_derive_at_runtime

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Specifies a product or sum type using a GADT binary tree representation. We use a single representation with several parameters so that tuples, records, variants, and polymorphic variants may all be understood with one set of types.

type ('whole, 'part) leaf

The data stored at the leaf of a type. In product types, this represents a single field. In variant types, this represents a single case.

'whole is the type of the enclosing product or sum type.

'part is the type of the data stored in the case or field.

type (!'left, !'right) node

A node combining two subtrees of derived values. For product types, this is 'left * 'right. For sum types, this is ('left, 'right) Either.t.

The ! below means that node must be injective in both type parameters. This is required for the Tree.t GADT to typecheck, below.

type ('whole, 'tree) conversion

Conversion function between a type and its generic "tree-shaped" type. In product types, this is a constructor mapping a 'tree of tuples to the 'whole type. In sum types, this is a conversion from a 'whole value to a 'tree of Either.t types.

module Tree : sig ... end

The recursive tree structure of a product or sum type representation.

module Root : sig ... end

The root of a product or sum type binary tree representation. Contains the binary tree, and a conversion function between the "flat" type and the binary tree type using pairs or Eithers.

type _ t =
  1. | T : ('whole, 'tree) Root.t -> 'whole t

A product or sum type representation, hiding the internal tree type.

OCaml

Innovation. Community. Security.