package dolmen

  1. Overview
  2. Docs
Module type
Class type
include Tff
type t

The type of types.

type def

The type of type definitions

type path

The type of paths to constants.

type 'a tag

A type for tags to attach to arbitrary types.

val print : Format.formatter -> t -> unit

Printing function.

exception Prenex_polymorphism of t

Raised when the type provided is polymorphic, but occurred in a place where polymorphic types are forbidden by prenex/rank-1 polymorphism.

module Var : sig ... end

A module for variables that occur in types.

module Const : sig ... end

A module for constant symbols the occur in types.

val equal : t -> t -> bool

Test equality of types.

val prop : t

The type of propositions

val of_var : Var.t -> t

Create a type from a variable.

val apply : Const.t -> t list -> t

Application for types.

val fv : t -> Var.t list

Returns the list of free_variables in the type.

val set_wildcard : Var.t -> t -> unit

Set a wildcard.

val add_wildcard_hook : hook:(Var.t -> t -> unit) -> Var.t -> unit

Add a hook to a wildcard, the hook will be run

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

Annotate the given type with the given tag and value.

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

Add a value to the list of values bound to a tag.

type view = private [>
  1. | `Wildcard of Var.t
  2. | `Arrow of t list * t
  3. | `Pi of Var.t list * t

Partial views for types.

val view : t -> view

Partial view of a type.

val freshen : t -> t

Replaces all bound variables in a type, ensuring that the returned type contains only fresh bound type variables.

val instance_of : t -> t -> t list option

instance_of poly t decides whether t is an instance of poly, that is whether there are some types l such that a term of type poly applied to type arguments l gives a term of type t.

val arrow : t list -> t -> t

Create a function type.

val pi : Var.t list -> t -> t

Create a rank-1/prenex polymorphc type.