summaryrefslogtreecommitdiff
path: root/compiler/utils
diff options
context:
space:
mode:
authorPatrick Palka <patrick@parcs.ath.cx>2013-03-07 15:19:57 -0500
committerSimon Peyton Jones <simonpj@microsoft.com>2013-03-09 12:46:30 +0000
commit263372ea7a3911b4bb76272a3bc251e2623f80ff (patch)
tree7508a55d80a956feae3bf571069a10f4b2539a50 /compiler/utils
parent1a7284814236af62e03dad1fe35cced81d33b145 (diff)
downloadhaskell-263372ea7a3911b4bb76272a3bc251e2623f80ff.tar.gz
Fix pretty printing of human-readable integers (#7750)
Diffstat (limited to 'compiler/utils')
-rw-r--r--compiler/utils/Outputable.lhs5
1 files changed, 4 insertions, 1 deletions
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:
--