implicitt/lib/Core/Metaenv.ml

24 lines
487 B
OCaml

module C = Common
module V = Value
open List
type mentry
= Unsolved of V.value (* type *)
| Solved of (V.value * V.value) (* solution : type *)
let metaEntries : mentry list ref = ref []
let getMetaEntry (i : int) =
nth (! metaEntries) i
let getMetaType (i : int) =
match getMetaEntry i with
| Unsolved ty -> ty
| Solved (_, ty) -> ty
let resolveMeta (Mv i : C.meta) =
match getMetaEntry i with
| Unsolved ty -> V.Stuck (V.Meta (Mv i), ty)
| Solved (tr, _) -> tr