Make HTML pretty-printing prettier
[hcoop/domtool2.git] / src / htmlPrint.sml
index 2018556..c752c3f 100644 (file)
@@ -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]