From b5420538da04984ca42eb4284a9be27f3b5ba021 Mon Sep 17 00:00:00 2001 From: Pierre-Marie Pédrot Date: Fri, 8 Apr 2016 00:58:56 +0200 Subject: 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. --- lib/genarg.ml | 12 +++++++----- lib/genarg.mli | 3 ++- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'lib') 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 -- cgit v1.2.3