From 246df63a73a1a583284e38e61f94ed4ac0874ece Mon Sep 17 00:00:00 2001 From: Vladimir Azarov Date: Fri, 30 May 2025 15:49:48 +0200 Subject: Statements --- common.sml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'common.sml') diff --git a/common.sml b/common.sml index 788c28b..75ed15e 100644 --- a/common.sml +++ b/common.sml @@ -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 -- cgit v1.2.3