From 8c57a89d75cc1d4fd050bd3767f9c881b1766c4a Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Sat, 26 May 2007 15:45:48 +0000 Subject: [PATCH] Make HTML pretty-printing prettier --- src/htmlPrint.sml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/htmlPrint.sml b/src/htmlPrint.sml index 2018556..c752c3f 100644 --- a/src/htmlPrint.sml +++ b/src/htmlPrint.sml @@ -95,10 +95,13 @@ fun p_typ' pn (t, _) = TBase s => typ s | TList t => dBox [punct "[", p_typ' false t, punct "]"] | TArrow (t1, t2) => - parenIf pn [p_typ' true t1, space 1, punct "->", space 1, p_typ' true t2] + parenIf pn [p_typ' true t1, space 1, punct "->", space 1, p_typ' false t2] | TAction (p, r1, r2) => - parenIf pn [p_predBoxed p, space 1, p_record r1, space 1, - punct "=>", space 1, p_record r2] + (case (StringMap.numItems r1, StringMap.numItems r2) of + (0, 0) => parenIf pn [p_predBoxed p] + | (_, 0) => parenIf pn [p_predBoxed p, space 1, p_record r1] + | _ => parenIf pn [p_predBoxed p, space 1, p_record r1, space 1, + punct "=>", space 1, p_record r2]) | TNested (p, t) => parenIf pn [p_pred' false p, space 1, punct "=>", space 1, p_typ' false t] -- 2.20.1