package fsml

  1. Overview
  2. Docs

Module Fsml.TypesSource

Types

Sourcetype 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

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

Builders

Sourceval new_type_var : unit -> t var

new_type_var () returns a fresh type variable

Sourceval new_size_var : unit -> size var

new_size_var () returns a fresh size variable

Sourceval type_int : unit -> t

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

Sourceval trivial_scheme : t -> typ_scheme

Unification

Sourceexception TypeConflict of t * t
Sourceexception TypeCircularity of t * t
Sourceval unify : t -> t -> unit
Sourceval type_instance : typ_scheme -> t
Sourceval real_type : t -> t
Sourceexception Polymorphic of t
Sourceval mono_type : t -> t

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

Printing

Sourceval to_string : t -> string