aboutsummaryrefslogtreecommitdiff
path: root/vernac/declareDef.ml
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2019-06-20 20:29:34 +0200
committerPierre-Marie Pédrot2019-06-20 20:29:34 +0200
commit500e386685163b7491e8ff2bb6e2b8885a35756b (patch)
treeb27d7bd6e1677ab972462c22eab0e1e5a52e63c5 /vernac/declareDef.ml
parentd501690a7d767d4a542867c5b6a65a722fa8c4c1 (diff)
parentd5566d72e6dbefc3cf55cf4da13c99b8391c6d8b (diff)
Merge PR #9645: [proof] Remove terminator type, unifying regular and obligation ones.
Ack-by: ejgallego Ack-by: gares Reviewed-by: ppedrot
Diffstat (limited to 'vernac/declareDef.ml')
-rw-r--r--vernac/declareDef.ml25
1 files changed, 24 insertions, 1 deletions
diff --git a/vernac/declareDef.ml b/vernac/declareDef.ml
index 93cd67a9d3..42327d6bdd 100644
--- a/vernac/declareDef.ml
+++ b/vernac/declareDef.ml
@@ -14,6 +14,29 @@ open Entries
open Globnames
open Impargs
+(* Hooks naturally belong here as they apply to both definitions and lemmas *)
+module Hook = struct
+ module S = struct
+ type t = UState.t
+ -> (Names.Id.t * Constr.t) list
+ -> Decl_kinds.locality
+ -> Names.GlobRef.t
+ -> unit
+ end
+
+ type t = S.t CEphemeron.key
+
+ let make hook = CEphemeron.create hook
+
+ let call ?hook ?fix_exn uctx trans l c =
+ try Option.iter (fun hook -> CEphemeron.get hook uctx trans l c) hook
+ with e when CErrors.noncritical e ->
+ let e = CErrors.push e in
+ let e = Option.cata (fun fix -> fix e) e fix_exn in
+ Util.iraise e
+end
+
+(* Locality stuff *)
let declare_definition ident (local, p, k) ?hook_data ce pl imps =
let fix_exn = Future.fix_exn_of ce.const_entry_body in
let gr = match local with
@@ -32,7 +55,7 @@ let declare_definition ident (local, p, k) ?hook_data ce pl imps =
match hook_data with
| None -> ()
| Some (hook, uctx, extra_defs) ->
- Lemmas.call_hook ~fix_exn ~hook uctx extra_defs local gr
+ Hook.call ~fix_exn ~hook uctx extra_defs local gr
end;
gr