Commit dd5f5c8e authored by POTTIER Francois's avatar POTTIER Francois

Export [fresh] and [domain] out of [SortUnification].

parent 5a5e5b42
......@@ -54,6 +54,20 @@ let arrow (args : variable list) : variable =
let star : variable =
arrow []
let fresh () =
fresh None
(* Sort accessors. *)
let domain (x : variable) : variable list =
match structure x with
| Some (Arrow xs) ->
xs
| None ->
(* It is up to our caller to ensure that [domain] is never applied
to a unification variable that carries no structure. *)
assert false
(* -------------------------------------------------------------------------- *)
(* A printer. *)
......
......@@ -24,6 +24,12 @@ type variable
val star: variable
val arrow: variable list -> variable
val fresh: unit -> variable
(* [domain] is the opposite of [arrow]. If [x] has been unified with an
arrow, then [domain x] returns its domain. Otherwise, it fails. Use
with caution. *)
val domain: variable -> variable list
exception Unify of variable * variable
exception Occurs of variable * variable
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment