aboutsummaryrefslogtreecommitdiffhomepage
path: root/engine
diff options
context:
space:
mode:
authorGravatar Pierre-Marie Pédrot <pierre-marie.pedrot@inria.fr>2016-11-07 13:27:16 +0100
committerGravatar Pierre-Marie Pédrot <pierre-marie.pedrot@inria.fr>2017-02-14 17:26:40 +0100
commit3b8acc174490878a3d0c9345e34a0ecb1d3abd66 (patch)
treea9567a1cc4be9d0625efcb94b021b4729429c0bd /engine
parentb77579ac873975a15978c5a4ecf312d577746d26 (diff)
Typeclasses API using EConstr.
Diffstat (limited to 'engine')
-rw-r--r--engine/termops.ml9
-rw-r--r--engine/termops.mli2
2 files changed, 11 insertions, 0 deletions
diff --git a/engine/termops.ml b/engine/termops.ml
index f191e2dc1..e5db3c085 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
diff --git a/engine/termops.mli b/engine/termops.mli
index 4becca907..c90fdf9c2 100644
--- a/engine/termops.mli
+++ b/engine/termops.mli
@@ -264,6 +264,8 @@ val dependency_closure : env -> Evd.evar_map -> Context.Named.t -> Id.Set.t -> I
(** Test if an identifier is the basename of a global reference *)
val is_section_variable : Id.t -> bool
+val global_of_constr : Evd.evar_map -> EConstr.constr -> Globnames.global_reference puniverses
+
val isGlobalRef : Evd.evar_map -> EConstr.t -> bool
val is_template_polymorphic : env -> Evd.evar_map -> EConstr.t -> bool