package dolmen

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

A module for Algebraic datatype constructors.

type t = term_cst

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 print : Stdlib.Format.formatter -> t -> unit

Printer.

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 ty : t -> ty

Returns the type 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 get_tag : t -> 'a Tag.t -> 'a option

Get the value bound to a tag.

val get_tag_list : t -> 'a list Tag.t -> 'a list

Get the list of values bound to a list tag, returning the empty list if no value is bound.

val get_tag_last : t -> 'a list Tag.t -> 'a option

Get the last value bound to a list tag.

val set_tag : t -> 'a Tag.t -> 'a -> unit

Set the value bound to the tag.

val add_tag : t -> 'a list Tag.t -> 'a -> unit

Bind an additional value to a list tag.

val add_tag_opt : t -> 'a list Tag.t -> 'a option -> unit

Optionally bind an additional value to a list tag.

val add_tag_list : t -> 'a list Tag.t -> 'a list -> unit

Bind a list of additional values to a list tag.

val unset_tag : t -> _ Tag.t -> unit

Remove the binding to the given tag.

OCaml

Innovation. Community. Security.