diff options
Diffstat (limited to 'common.sml')
-rw-r--r-- | common.sml | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -184,11 +184,14 @@ type ('t1, 't2, 'a, 'b, 'c) a2printer = (bool * ((string -> unit) * 'a)) * 'b -> 't1 -> 't2 -> ((bool * ((string -> unit) * 'a)) * 'b -> 'c) -> 'c -fun popt p v out = +fun poptInternal addSpace none p v out = case v of - NONE => Printf out `"none" % - | SOME v => Printf out A1 p v % -val Popt = fn z => bind A2 popt z + NONE => Printf out `none % + | SOME v => Printf out A1 p v `(if addSpace then " " else "") % + +fun poptN z = poptInternal false z +val Popt = fn z => bind A2 (poptInternal false "") z +val PoptS = fn z => bind A2 (poptInternal true "") z fun plist p l (s, parens) out = let |