From 263372ea7a3911b4bb76272a3bc251e2623f80ff Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Thu, 7 Mar 2013 15:19:57 -0500 Subject: Fix pretty printing of human-readable integers (#7750) --- compiler/utils/Outputable.lhs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'compiler/utils') diff --git a/compiler/utils/Outputable.lhs b/compiler/utils/Outputable.lhs index f26f918068..bd2a955469 100644 --- a/compiler/utils/Outputable.lhs +++ b/compiler/utils/Outputable.lhs @@ -825,9 +825,12 @@ intWithCommas :: Integral a => a -> SDoc intWithCommas n | n < 0 = char '-' <> intWithCommas (-n) | q == 0 = int (fromIntegral r) - | otherwise = intWithCommas q <> comma <> int (fromIntegral r) + | otherwise = intWithCommas q <> comma <> zeroes <> int (fromIntegral r) where (q,r) = n `quotRem` 1000 + zeroes | r >= 100 = empty + | r >= 10 = char '0' + | otherwise = ptext (sLit "00") -- | Converts an integer to a verbal index: -- -- cgit v1.2.1