aboutsummaryrefslogtreecommitdiff
path: root/vernac/comInductive.ml
diff options
context:
space:
mode:
authorGaëtan Gilbert2018-08-23 11:38:36 +0200
committerGaëtan Gilbert2018-09-13 14:03:24 +0200
commit6ccacec1b70b9de0ddd8d098f25c367ed975120a (patch)
treef8266ef2f0be32765cfa270089d1564a26d8da6a /vernac/comInductive.ml
parent3881fb7b93196a304b332ae81f1debde1ce9aaf9 (diff)
Add option to control automatic template polymorphism.
Diffstat (limited to 'vernac/comInductive.ml')
-rw-r--r--vernac/comInductive.ml16
1 files changed, 15 insertions, 1 deletions
diff --git a/vernac/comInductive.ml b/vernac/comInductive.ml
index 7745f3eec7..fb9d21c429 100644
--- a/vernac/comInductive.ml
+++ b/vernac/comInductive.ml
@@ -35,6 +35,18 @@ module RelDecl = Context.Rel.Declaration
(* 3b| Mutual inductive definitions *)
+let should_auto_template =
+ let open Goptions in
+ let auto = ref true in
+ let _ = declare_bool_option
+ { optdepr = false;
+ optname = "Automatically make some inductive types template polymorphic";
+ optkey = ["Auto";"Template";"Polymorphism"];
+ optread = (fun () -> !auto);
+ optwrite = (fun b -> auto := b); }
+ in
+ fun () -> !auto
+
let rec complete_conclusion a cs = CAst.map_with_loc (fun ?loc -> function
| CProdN (bl,c) -> CProdN (bl,complete_conclusion a cs c)
| CLetIn (na,b,t,c) -> CLetIn (na,b,t,complete_conclusion a cs c)
@@ -425,7 +437,9 @@ let interp_mutual_inductive_gen env0 ~template (uparamsl,paramsl,indl) notations
| Some template ->
if poly && template then user_err Pp.(strbrk "template and polymorphism not compatible");
template
- | None -> not poly && Option.cata (fun s -> not (Sorts.is_small s)) false concl
+ | None ->
+ should_auto_template () && not poly &&
+ Option.cata (fun s -> not (Sorts.is_small s)) false concl
in
{ mind_entry_typename = ind.ind_name;
mind_entry_arity = arity;