package dolmen

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

A module for Algebraic datatype constructors.

type t = term_const

An algebraic type constructor. Note that such constructors are used to build terms, and not types, e.g. consider the following: type 'a list = Nil | Cons of 'a * 'a t, then Nil and Cons are the constructors, while list would be a type constant of arity 1 used to name the type.

val hash : t -> int

A hash function for adt constructors, should be suitable to create hashtables.

val equal : t -> t -> bool

An equality function on adt constructors. Should be compatible with the hash function.

val compare : t -> t -> int

Comparison function on variables.

val arity : t -> int * int

Returns the arity of a constructor.

val void : t

Only constructor for the type unit.

val pattern_arity : t -> ty -> ty list -> ty list

Used in the type-checking of pattern matching. pattern_arity cstr ret ty_args should return the types of the expected arguments args such that apply_cstr cstr ty_args args has type ret.

  • raises Bad_term_arity

    if the provided type argument list is not of the correct length

val tag : t -> 'a tag -> 'a -> unit

Tag a constant.

val get_tag : t -> 'a tag -> 'a list

Return the list of values associated to the tag.

val get_tag_last : t -> 'a tag -> 'a option

Return the last value associated to the tag (if any).

OCaml

Innovation. Community. Security.