aboutsummaryrefslogtreecommitdiff
path: root/kernel/constr.ml
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2018-10-17 15:29:47 +0200
committerPierre-Marie Pédrot2018-10-17 15:29:47 +0200
commit15998894ff76b1fa9354085ea0bddae4f8f23ddf (patch)
tree254cc3a53b6aa344f49a10cba32e14acf97d2905 /kernel/constr.ml
parent063cf49f40511730c8c60c45332e92823ce4c78f (diff)
parent6aa0aa37e19457a8c0c3ad36f7bbead058442344 (diff)
Merge PR #8694: Various cleanups of universe apis
Diffstat (limited to 'kernel/constr.ml')
-rw-r--r--kernel/constr.ml12
1 files changed, 12 insertions, 0 deletions
diff --git a/kernel/constr.ml b/kernel/constr.ml
index c97969c0e0..b490aa5092 100644
--- a/kernel/constr.ml
+++ b/kernel/constr.ml
@@ -227,6 +227,12 @@ let mkMeta n = Meta n
(* Constructs a Variable named id *)
let mkVar id = Var id
+let mkRef (gr,u) = let open GlobRef in match gr with
+ | ConstRef c -> mkConstU (c,u)
+ | IndRef ind -> mkIndU (ind,u)
+ | ConstructRef c -> mkConstructU (c,u)
+ | VarRef x -> mkVar x
+
(************************************************************************)
(* kind_of_term = constructions as seen by the user *)
(************************************************************************)
@@ -401,6 +407,12 @@ let destCoFix c = match kind c with
| CoFix cofix -> cofix
| _ -> raise DestKO
+let destRef c = let open GlobRef in match kind c with
+ | Var x -> VarRef x, Univ.Instance.empty
+ | Const (c,u) -> ConstRef c, u
+ | Ind (ind,u) -> IndRef ind, u
+ | Construct (c,u) -> ConstructRef c, u
+ | _ -> raise DestKO
(******************************************************************)
(* Flattening and unflattening of embedded applications and casts *)