Module Sstt.Descr

Monomorphic type descriptors.

Basics

type t

The type of monomorphics descriptors. It represents a disjoint union of components.

val any : t

The top element of t (the set of all values of type t).

val empty : t

The bottom element of t (the empty set of values of type t).

val compare : t -> t -> int

Comparison working on the internal representation of t.

val equal : t -> t -> bool

Equality, equal a b is equivalent to compare a b = 0.

Components

module Intervals = VDescr.Descr.Intervals

Integer components.

module Enums = VDescr.Descr.Enums

Enums components.

module Arrows = VDescr.Descr.Arrows

Arrow components.

module Records = VDescr.Descr.Records

Record components.

module Tuples = VDescr.Descr.Tuples

Tuple components.

module Tags = VDescr.Descr.Tags

Tagged types components.

Extracting components

type component =
  1. | Intervals of Intervals.t
  2. | Enums of Enums.t
  3. | Arrows of Arrows.t
  4. | Records of Records.t
  5. | Tuples of Tuples.t
  6. | Tags of Tags.t

A uniform representation of components, tagged with their kind. It can be usefull if some components have a uniform behaviour. For instance:


let map_arrow_records fr fa = function
| Arrows a -> Arrows (Arrows.map_nodes fa a)
| Records r -> Records (Records.map_nodes fr r)
| c -> c
val components : t -> component list

Break down a type into its list of components.

val set_component : t -> component -> t

set_component t c returns the type t ~\setminus~ 𝟙c~\cup~ c, where 𝟙c is the top of component c.

val of_components : component list -> t

of_components [c1; ...; cn] returns \bigcup_{i=1\ldots n} c_i

val of_component : component -> t

of_component c is equivalent to of_components [c].

val get_intervals : t -> Intervals.t

Returns the Sstt.Intervals component of a descriptor.

val get_enums : t -> Enums.t

Returns the Sstt.Enums component of a descriptor.

val get_arrows : t -> Arrows.t

Returns the Sstt.Arrows component of a descriptor.

val get_records : t -> Records.t

Returns the Sstt.Records component of a descriptor.

val get_tuples : t -> Tuples.t

Returns the Sstt.Tuples component of a descriptor.

val get_tags : t -> Tags.t

Returns the Sstt.Tags component of a descriptor.

Building descriptors from components

val mk_enum : Enums.Atom.t -> t

Creates a singleton type descriptor from a single enum.

val mk_enums : Enums.t -> t

Creates a type descriptor from an Sstt.Enums component.

val mk_interval : Intervals.Atom.t -> t

Creates a type descriptor from a single interval.

val mk_intervals : Intervals.t -> t

Creates a type descriptor from an Sstt.Intervals component.

val mk_arrow : Arrows.Atom.t -> t

Creates a type descriptor from a single arrow.

val mk_arrows : Arrows.t -> t

Creates a type descriptor from an Sstt.Arrows component.

val mk_record : Records.Atom.t -> t

Creates a type descriptor from a single record.

val mk_records : Records.t -> t

Creates a type descriptor from an Sstt.Records component.

val mk_tuple : Tuples.Comp.Atom.t -> t

Creates a type descriptor from a single tuple.

val mk_tuplecomp : Tuples.Comp.t -> t

Creates a type descriptor from a tuple component of a fixed arity tuple.

val mk_tuples : Tuples.t -> t

Creates a type descriptor from a Sstt.Tuples component family, mixing several tuple arities.

val mk_tag : Tags.Comp.Atom.t -> t

Creates a type descriptor from a single tagged type.

val mk_tagcomp : Tags.Comp.t -> t

Creates a type descriptor from a tagged component of a fixed tag.

val mk_tags : Tags.t -> t

Creates a type descriptor from a Sstt.Tags component family, mixing several tuple arities.

Misc. operations

val map_nodes : (Ty.t -> Ty.t) -> t -> t

map_nodes f t replaces every node n in t by the node f n.