Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/core/Env.ml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ let empty () =

let create ~anchor = {anchor; next = first_var}

let pp ppf env = Format.fprintf ppf "ENV(%d)" env.anchor

let fresh ~scope e =
let v = Obj.magic (Term.Var.make ~env:e.anchor ~scope e.next) in
e.next <- 1 + e.next;
Expand All @@ -37,7 +39,8 @@ let fresh ~scope e =
let check env v = (v.Term.Var.env = env.anchor)

let check_exn env v =
if check env v then () else failwith "OCanren fatal (Env.check): wrong environment"
if check env v then ()
else failwith "OCanren fatal (Env.check): wrong environment"

let var env x =
match Term.var x with
Expand Down
2 changes: 2 additions & 0 deletions src/core/Env.mli
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ type t
the variable index introduced last. That's why {!empty} has extra unit argument. *)
val empty : unit -> t

val pp : Format.formatter -> t -> unit

val create : anchor:Term.Var.env -> t

(** Creating a fresh variable takes an extra argument [scope] to decide if
Expand Down