aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2016-04-08 00:58:56 +0200
committerPierre-Marie Pédrot2016-04-08 01:44:10 +0200
commitb5420538da04984ca42eb4284a9be27f3b5ba021 (patch)
treeaef40fc7c5b541e47a15e62488ca617b96012f78 /lib
parent1f6a31d138bcfcf341f28772de7c5e08906167c5 (diff)
Fixing printing of toplevel values.
This is not perfect yet, in particular the whole precedence system is a real mess, as there is a real need for tidying up the Pptactic implementation. Nonetheless, printing toplevel values is only used for debugging purposes, where an ugly display is better than none at all.
Diffstat (limited to 'lib')
-rw-r--r--lib/genarg.ml12
-rw-r--r--lib/genarg.mli3
2 files changed, 9 insertions, 6 deletions
diff --git a/lib/genarg.ml b/lib/genarg.ml
index 5d5b29c99d..ef0de89afb 100644
--- a/lib/genarg.ml
+++ b/lib/genarg.ml
@@ -61,11 +61,13 @@ struct
end
| _ -> None
- let rec repr : type a. a tag -> std_ppcmds = function
- | Base t -> str (ValT.repr t)
- | List t -> repr t ++ spc () ++ str "list"
- | Opt t -> repr t ++ spc () ++ str "option"
- | Pair (t1, t2) -> str "(" ++ repr t1 ++ str " * " ++ repr t2 ++ str ")"
+ let repr = ValT.repr
+
+ let rec pr : type a. a tag -> std_ppcmds = function
+ | Base t -> str (repr t)
+ | List t -> pr t ++ spc () ++ str "list"
+ | Opt t -> pr t ++ spc () ++ str "option"
+ | Pair (t1, t2) -> str "(" ++ pr t1 ++ str " * " ++ pr t2 ++ str ")"
end
diff --git a/lib/genarg.mli b/lib/genarg.mli
index 6cc7893dc4..93665fd45d 100644
--- a/lib/genarg.mli
+++ b/lib/genarg.mli
@@ -99,7 +99,8 @@ sig
type t = Dyn : 'a tag * 'a -> t
val eq : 'a tag -> 'b tag -> ('a, 'b) CSig.eq option
- val repr: 'a tag -> Pp.std_ppcmds
+ val repr : 'a typ -> string
+ val pr : 'a tag -> Pp.std_ppcmds
end
(** Dynamic types for toplevel values. While the generic types permit to relate