package logtk

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type untyped

untyped term

type typed

untyped term

typed term

val infer_exn : Ctx.t -> untyped -> LogtkType.t * typed Closure.t

Infer the type of this term under the given signature. This updates the context's typing environment!

  • parameter ctx

    the context

  • parameter untyped

    the untyped term whose type must be inferred

  • returns

    the inferred type of the untyped term (possibly a type var) along with a closure to produce a typed term once every constraint has been solved

Safe version of infer_exn. It returns `Error s rather than raising LogtkType.Error if the typechecking fails.

Constraining types

This section is mostly useful for inferring a signature without converting untyped_terms into typed_terms.

val constrain_term_term_exn : Ctx.t -> untyped -> untyped -> unit

Force the two terms to have the same type in this context

val constrain_term_type_exn : Ctx.t -> untyped -> LogtkType.t -> unit

Force the term's type and the given type to be the same.

val constrain_term_term : Ctx.t -> untyped -> untyped -> unit or_error

Safe version of constrain_term_term_exn

val constrain_term_type : Ctx.t -> untyped -> LogtkType.t -> unit or_error

Safe version of constrain_term_type_exn

OCaml

Innovation. Community. Security.