aboutsummaryrefslogtreecommitdiffhomepage
path: root/kernel/term.ml
diff options
context:
space:
mode:
authorGravatar Enrico Tassi <Enrico.Tassi@inria.fr>2014-12-24 14:34:51 +0100
committerGravatar Enrico Tassi <Enrico.Tassi@inria.fr>2014-12-26 15:07:03 +0100
commit5d6106a075b79abbb92b03bbca7b13a517cf4925 (patch)
tree8dd90fb5483a623b27f3d62a18e7a6cf088fc4af /kernel/term.ml
parentdca4b978ff8bfa2eeee864edac4199d9d9df3d5e (diff)
Term: include a function to print terms
I find it very odd not to have a pretty printer for terms than can be called from *everywhere*. This commit sticks in Term a long spaghetti to let Printer install a printing function.
Diffstat (limited to 'kernel/term.ml')
-rw-r--r--kernel/term.ml7
1 files changed, 7 insertions, 0 deletions
diff --git a/kernel/term.ml b/kernel/term.ml
index 3adfa5e37..508d9b81a 100644
--- a/kernel/term.ml
+++ b/kernel/term.ml
@@ -679,3 +679,10 @@ let kind_of_type t = match kind_of_term t with
| Proj _ | Case _ | Fix _ | CoFix _ | Ind _)
-> AtomicType (t,[||])
| (Lambda _ | Construct _) -> failwith "Not a type"
+
+(* This is not dead code, it is there to have a constr printer available
+ * everywhere *)
+let print_val, print_hook =
+ Hook.make ~default:(fun x -> Pp.str"constr printer not installed") ()
+let print t = Hook.get print_val t
+