package liquidsoap-lang

  1. Overview
  2. Docs

User-friendly representation of types.

val show_record_schemes : bool ref

Show generalized variables in records.

val global_evar_names : bool ref

Use globally unique names for existential variables.

include module type of struct include Type_base.R end
type meth = Type_base.R.meth = {
  1. name : string;
  2. optional : bool;
  3. scheme : var list * t;
  4. json_name : string option;
}
and t = [
  1. | `Constr of string * (Type_base.variance * t) list
  2. | `List of t * [ `Object | `Tuple ]
  3. | `Tuple of t list
  4. | `Nullable of t
  5. | `Meth of meth * t
  6. | `Arrow of (bool * string * t) list * t
  7. | `Getter of t
  8. | `EVar of var
  9. | `UVar of var
  10. | `Ellipsis
  11. | `Range_Ellipsis
  12. | `Debug of string * t * string
]
and var = string * Type_base.Constraints.t
val excerpt : (Lexing.position * Lexing.position) -> string option

Given a position, find the relevant excerpt.

val excerpt_opt : (Lexing.position * Lexing.position) option -> string option
val name : int -> string

Given a strictly positive integer, generate a name in a-z+: a, b, ... z, aa, ab, ... az, ba, ...

val evar_global_name : int -> string

Generate a globally unique name for evars (used for debugging only).

val make : ?filter_out:(Type_base.t -> bool) -> ?generalized:Type_base.var list -> Type_base.t -> t

Compute the structure that a term represents, given the list of universally quantified variables. Also takes care of computing the printing name of variables, including constraint symbols, which are removed from constraint lists. It supports a mechanism for filtering out parts of the type, which are then translated as `Ellipsis.

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

Print a type representation. Unless in debug mode, variable identifiers are not shown, and variable names are generated. Names are only meaningful over one printing, as they are re-used.

val to_string : Type_base.R.t -> string
val print_type : Format.formatter -> Type_base.t -> unit
val print_scheme : Format.formatter -> (Type_base.var list * Type_base.t) -> unit
val string_of_type : ?generalized:Type_base.var list -> Type_base.t -> string

String representation of a type.

val string_of_scheme : (Type_base.var list * Type_base.t) -> string

String representation of a type scheme.

type explanation = bool * Type_base.t * Type_base.t * t * t
exception Type_error of explanation
val print_type_error : formatter:Format.formatter -> (Pos.Option.t -> 'a) -> explanation -> unit
OCaml

Innovation. Community. Security.