@@ -91,19 +91,22 @@ showCon d conName shownArgs = showParens (d >= App) $ conName ++ shownArgs
91showArg : Show a => (x : a) -> String
91showArg : Show a => (x : a) -> String
92showArg x = " " ++ showPrec App x
92showArg x = " " ++ showPrec App x
94+firstCharIs : (Char -> Bool) -> String -> Bool
95+firstCharIs p s with (strM s)
96+ firstCharIs p "" | StrNil = False
97+ firstCharIs p (strCons c cs) | StrCons c cs = p c
99+primNumShow : (a -> String) -> Prec -> a -> String
100+primNumShow f d x = let str = f x in showParens (d >= PrefixMinus && firstCharIs (== '-') str) str
94instance Show Int where
102instance Show Int where
95− show = prim__toStrInt
103+ showPrec = primNumShow prim__toStrInt
97instance Show Integer where
105instance Show Integer where
98− show = prim__toStrBigInt
106+ showPrec = primNumShow prim__toStrBigInt
100instance Show Double where
108instance Show Double where
101− show = prim__floatToStr
109+ showPrec = primNumShow prim__floatToStr
103−firstCharIs : (Char -> Bool) -> String -> Bool
104−firstCharIs p s with (strM s)
105− firstCharIs p "" | StrNil = False
106− firstCharIs p (strCons c cs) | StrCons c cs = p c
108protectEsc : (Char -> Bool) -> String -> String -> String
111protectEsc : (Char -> Bool) -> String -> String -> String
109protectEsc p f s = f ++ (if firstCharIs p s then "\\&" else "") ++ s
112protectEsc p f s = f ++ (if firstCharIs p s then "\\&" else "") ++ s