Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

22 lines (14 sloc) 0.732 kb
(** Handling of contexts.
A context is represented as an associative list which maps a variable [x]
to a pair [(t,e)] where [t] is its type and [e] is its value (optional).
*)
let lookup = List.assoc
(** [lookup_ty x ctx] returns the type of [x] in context [ctx]. *)
let lookup_ty x ctx = fst (lookup x ctx)
(** [lookup_ty x ctx] returns the value of [x] in context [ctx], or [None]
if [x] has no assigned value. *)
let lookup_value x ctx = snd (lookup x ctx)
(** [extend x t ctx] returns [ctx] extended with variable [x] of type [t],
whereas [extend x t ~value:e ctx] returns [ctx] extended with variable [x]
of type [t] and assigned value [e]. *)
let extend x t ?value ctx = (x, (t, value)) :: ctx
Jump to Line
Something went wrong with that request. Please try again.