Module Lisp.Type

Lisp Type System.

Primus Lisp is equipped with the gradual type system that features type inference.

type t

A type of an expression

type env

Typing environment is a mapping from expressions to types.

type signature

Definition signature

type error

An abstract type error

type parameters = [
  1. | `All of t
  2. | `Gen of t list * t
  3. | `Tuple of t list
]

a type specifier for function parameters

Don't use this directly, this type is uses in the Spec eDSL. Use the Spec module directly.

module Spec : sig ... end

Type Specifier DSL.

val error : error observation

error p occurs when the typechecker detects an error p.

  • since 2.1.0
val errors : env -> error list

errors env is a list of type errors. @since 2.1.0

val check : Bap.Std.Var.t Bap.Std.seq -> program -> error list
  • deprecated [since 2020-02] use [Make(Machine).types] [errors] instead
val pp_error : Stdlib.Format.formatter -> error -> unit

pp_error ppf err prints a description of the type error err into the formatter ppf