Sstt.TySet-theoretic types (type references).
The type of (set-theoretic) types. A value of type t is a reference to a descriptor that represent its structure (its variables, components, …). Each value of type t contains a unique internal identifier which is used for equality
equal t1 t2 returns true if and only if t1 and t2 denote the same reference. It is provided e.g. to implement hash tables indexed by types and does not implement syntactic nor semantic equality. The function runs in constant time.
compare t1 t2 implements a total order on types, seen as references. compare t1 t2 = 0 if and only if equal t1 t2 = true. The function runs in constant time.
val hash : t -> inthash t returns a hash for the given type. The function runs in constant time.
val empty : tThe empty type, 𝟘.
val any : tThe top type, 𝟙.
conj l is the intersection of all the types in l. It returns any if l is the empty list.
disj l is the union of all the types in l. It returns empty if l is the empty list.
val is_empty : t -> boolEmptyness test. is_empty t returns true if and only if t is semantically equivalent to empty.
val is_any : t -> boolFullness test. is_any t returns true if and only if t is semantically equivalent to any.
Subtyping test. leq t1 t2 returns true if and only if t1 is a subtype of t2.
Type equivalence test. equiv t1 t2 returns true if and only if leq t1 t2 and leq t2 t1.
Disjointedness test. disjoint t1 t2 returns true if and only if cap t1 t2 is empty.
The VDescr module and its operations allow one to access the internal structure of a type.
module VDescr : sig ... endFull descriptors with top-level variables.
def t returns the full descriptor of t. For a given type (reference) t, def t is not necessarily constant: it may change over time, for instance when the descriptor of t is simplified.
val mk_descr : VDescr.Descr.t -> tmk_descr d creates a type from the monomorphic descriptor d.
val get_descr : t -> VDescr.Descr.tget_descr t extracts a monomorphic descriptor from t, which describes t by ignoring its top-level type variables.s
vars t returns the set of all variables in t. Note that due to simplifications some variables may or may not be present. For instance, if t_1 \equiv \alpha and t_2 \equiv \lnot \alpha
vars_toplevel t returns the top-level variables of t, that is, occurrences of variables that are not below a constructor.
of_eqs [(x1,t1);...;(xn,tn)] returns the types x1, ..., xn satisfying the system of equations x1=t1, ..., xn=tn. Raises: Invalid_argument if the set of equations is not contractive.
factorize t factorizes equivalent nodes in t. This operation may be expensive since it calls equiv internally.
module O : sig ... endOptional types are subsets of 𝟙\cup\bot. They are used for the type of record fields, to denote the fact that a field may be absent.