SsttThe API to manipulate them follows a layered structure to account for the fact that types are equi-recursive:
t (implemented by Ty.t) is a reference to a descriptor with top-level variables, t = va full descriptor with top-level variables v (implemented by type VDescr.t) represents a disjunctive normal form of positive and negative top-level variables and monomorphic descriptors:
v = \bigcup_{i=i\ldots m} ~~\bigcap_{j=1\ldots p} \alpha_{ij} \cap \bigcap_{j=1\ldots n} \lnot\beta_{ij} ~~\cap~~ d_i
d (implemented by Descr.t is a disjoint union of components. Components are intervals, enums, tuples, tagged types, arrows and records.Components such as tuples, tagged types, arrows and records correspond to type constructors and are union of intersections of atoms, the latter containing type references Ty.t. For instance, the component for arrows represents:
a = \bigcup_{i=1\ldots m} \bigcap_{j=1 \ldots p} t_{ij}^1 \rightarrow t_{ij}^2 \cap \bigcap_{j=1 \ldots n} \lnot(t_{ij}^1 \rightarrow t_{ij}^2)
module Ty : sig ... endSet-theoretic types (type references).
module VDescr : sig ... endFull descriptors with top-level variables.
module Descr : sig ... endMonomorphic type descriptors.
Components are the building blocks of types. Each component represents a union of intersections (a DNF) of a particular "type constructor" (basic types such as integers or enums, tuples, arrows, …).
The following modules are convenience aliases to modules found in Ty.VDescr.Descr.
These components represent the two basic types, integers and enums.
module Intervals : sig ... endInteger components.
module Enums : sig ... endEnums components.
Type constructor components come in two flavors: simple constructors such as arrows or records and families such as tuples or tagged type. The latter are infinte sets of components, indexed by a value (the arity for tuples and the tag for tagged types).
module Arrows : sig ... endArrow components.
module Records : sig ... endRecord components.
module Tuples : sig ... endTuple components.
module TupleComp : sig ... endComponent for a tuple of a particular fixed arity.
module Tags : sig ... endTagged types components.
module TagComp : sig ... endComponent for a type tagged with a particular tag.
Identifiers (type variables, record fields) all share a common interface. The library provides sets and maps whose elements and keys are identifiers.
module type NamedIdentifier = sig ... endmodule Label : sig ... endLabels used for field names in records.
module LabelSet : sig ... endSets of labels.
module LabelMap : sig ... endMaps indexed by labels.
module Var : sig ... endType variables.
module VarSet : sig ... endSets of type variables.
module VarMap : sig ... endMaps indexed by type variables.
module Tag : sig ... endTags used for tagged type (an alias of TagComp.Atom.Tag).
module Subst : sig ... endType substitutions
module Op : sig ... endHigh-level operations on types.
module Transform : sig ... endType transformation and simplification
module Tallying : sig ... endTallying (unification modulo subtyping constraints).
module Prec : sig ... endPrecedence of operators and associativity
module Printer : sig ... endThis modules provides several common data-types, encoded as tagged type with a particular tag.
module Extensions : sig ... end