aboutsummaryrefslogtreecommitdiff
path: root/engine/termops.ml
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2016-11-07 13:27:16 +0100
committerPierre-Marie Pédrot2017-02-14 17:26:40 +0100
commit3b8acc174490878a3d0c9345e34a0ecb1d3abd66 (patch)
treea9567a1cc4be9d0625efcb94b021b4729429c0bd /engine/termops.ml
parentb77579ac873975a15978c5a4ecf312d577746d26 (diff)
Typeclasses API using EConstr.
Diffstat (limited to 'engine/termops.ml')
-rw-r--r--engine/termops.ml9
1 files changed, 9 insertions, 0 deletions
diff --git a/engine/termops.ml b/engine/termops.ml
index f191e2dc12..e5db3c085b 100644
--- a/engine/termops.ml
+++ b/engine/termops.ml
@@ -818,6 +818,15 @@ let is_section_variable id =
try let _ = Global.lookup_named id in true
with Not_found -> false
+let global_of_constr sigma c =
+ let open Globnames in
+ match EConstr.kind sigma c with
+ | Const (c, u) -> ConstRef c, u
+ | Ind (i, u) -> IndRef i, u
+ | Construct (c, u) -> ConstructRef c, u
+ | Var id -> VarRef id, Univ.Instance.empty
+ | _ -> raise Not_found
+
let isGlobalRef sigma c =
match EConstr.kind sigma c with
| Const _ | Ind _ | Construct _ | Var _ -> true