aboutsummaryrefslogtreecommitdiffhomepage
path: root/printing
diff options
context:
space:
mode:
authorGravatar Arnaud Spiwack <arnaud@spiwack.net>2014-09-03 11:40:27 +0200
committerGravatar Arnaud Spiwack <arnaud@spiwack.net>2014-09-04 10:25:54 +0200
commitb18b40878f071b6c7d67d1a2d031370f7a498d0b (patch)
tree595398248a70dd2607c983c5dd3eb8913614b084 /printing
parentac2fdfb222083faa9c3893194e020bed38555ddb (diff)
Print [Variant] types with the keyword [Variant].
Involves changing the [mind_finite] field in the kernel from a bool to the trivalued type [Decl_kinds.recursivity_kind]. This is why so many files are (unfortunately) affected. It would not be very surprising if some bug was introduced.
Diffstat (limited to 'printing')
-rw-r--r--printing/printer.ml9
-rw-r--r--printing/printmod.ml10
2 files changed, 16 insertions, 3 deletions
diff --git a/printing/printer.ml b/printing/printer.ml
index 7938b7bb0..7971e0aaa 100644
--- a/printing/printer.ml
+++ b/printing/printer.ml
@@ -780,8 +780,15 @@ let print_one_inductive env mib ((_,i) as ind) =
let print_mutual_inductive env mind mib =
let inds = List.init (Array.length mib.mind_packets) (fun x -> (mind, x))
in
+ let keyword =
+ let open Decl_kinds in
+ match mib.mind_finite with
+ | Finite -> "Inductive "
+ | BiFinite -> "Variant "
+ | CoFinite -> "CoInductive "
+ in
hov 0 (pr_polymorphic mib.mind_polymorphic ++
- str (if mib.mind_finite then "Inductive " else "CoInductive ") ++
+ str keyword ++
prlist_with_sep (fun () -> fnl () ++ str" with ")
(print_one_inductive env mib) inds ++
pr_universe_ctx (Univ.instantiate_univ_context mib.mind_universes))
diff --git a/printing/printmod.ml b/printing/printmod.ml
index 7dd59cf05..ffee2e244 100644
--- a/printing/printmod.ml
+++ b/printing/printmod.ml
@@ -160,8 +160,14 @@ let print_body is_impl env mp (l,body) =
let env = Option.get env in
Printer.pr_mutual_inductive_body env (MutInd.make2 mp l) mib
with e when Errors.noncritical e ->
- (if mib.mind_finite then str "Inductive " else str "CoInductive")
- ++ name)
+ let keyword =
+ let open Decl_kinds in
+ match mib.mind_finite with
+ | Finite -> "Inductive "
+ | BiFinite -> "Variant "
+ | CoFinite -> "CoInductive "
+ in
+ str keyword ++ name)
let print_struct is_impl env mp struc =
prlist_with_sep spc (print_body is_impl env mp) struc