package fsml

  1. Overview
  2. Docs

Types

type t =
  1. | TyInt of sign attr * size attr * range attr
  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

    *)
and 'a attr =
  1. | Const of 'a
  2. | Var of 'a attr var
and 'a var = {
  1. stamp : string;
  2. mutable value : 'a value;
}
and 'a value =
  1. | Unknown
  2. | Known of 'a
and sign =
  1. | Signed
  2. | Unsigned
and size = int
and range = {
  1. lo : int;
  2. hi : int;
}
val to_yojson : t -> Yojson.Safe.t
val attr_to_yojson : ('a -> Yojson.Safe.t) -> 'a attr -> 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
val sign_to_yojson : sign -> Yojson.Safe.t
val size_to_yojson : size -> Yojson.Safe.t
val range_to_yojson : range -> Yojson.Safe.t
type typ_scheme = {
  1. ts_params : ts_params;
  2. ts_body : t;
}
and ts_params = {
  1. tp_typ : t var list;
  2. tp_sign : sign attr var list;
  3. tp_size : size attr var list;
  4. tp_range : range attr var list;
}
val show_typ_scheme : typ_scheme -> Ppx_deriving_runtime.string
val show_ts_params : ts_params -> Ppx_deriving_runtime.string
val typ_scheme_to_yojson : typ_scheme -> Yojson.Safe.t
val ts_params_to_yojson : ts_params -> Yojson.Safe.t

Builders

val new_type_var : unit -> t var

new_type_var () returns a fresh type variable

val new_attr_var : unit -> 'a attr var

new_attr_var () returns a fresh type attribute variable

val type_int : unit -> t
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
val real_attr : 'a attr -> 'a attr
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