package fsml

  1. Overview
  2. Docs

Types

type t =
  1. | TyInt of t * size
    (*

    t is for signness

    *)
  2. | TyBool
  3. | TyArrow of t * t
    (*

    Internal use only

    *)
  4. | TyProduct of t list
    (*

    Internal use only

    *)
  5. | TyVar of t var
    (*

    Internal use only

    *)
  6. | TySigned
    (*

    Phantom type

    *)
  7. | TyUnsigned
    (*

    Phantom type

    *)
and size =
  1. | SzConst of int
  2. | SzVar of size var
and 'a var = {
  1. stamp : string;
  2. mutable value : 'a value;
}
and 'a value =
  1. | Unknown
  2. | Known of 'a
val to_yojson : t -> Yojson.Safe.t
val size_to_yojson : size -> Yojson.Safe.t
val var_to_yojson : ('a -> Yojson.Safe.t) -> 'a var -> Yojson.Safe.t
val value_to_yojson : ('a -> Yojson.Safe.t) -> 'a value -> Yojson.Safe.t
type typ_scheme = {
  1. ts_tparams : t var list;
  2. ts_sparams : size var list;
  3. ts_body : t;
}
val show_typ_scheme : typ_scheme -> Ppx_deriving_runtime.string
val typ_scheme_to_yojson : typ_scheme -> Yojson.Safe.t

Builders

val new_type_var : unit -> t var

new_type_var () returns a fresh type variable

val new_size_var : unit -> size var

new_size_var () returns a fresh size variable

val type_int : unit -> t

type_int () is TyInt (SzVar (new_size_var ()))

val trivial_scheme : t -> typ_scheme

Unification

exception TypeConflict of t * t
exception TypeCircularity of t * t
val unify : t -> t -> unit
val type_instance : typ_scheme -> t
val real_type : t -> t
exception Polymorphic of t
val mono_type : t -> t

Remove all type variables from type representation t. Raises !Polymorphic if t contains unresolved type variables.

Printing

val to_string : t -> string
OCaml

Innovation. Community. Security.