From 5f1bec0b602b6d4b341b5c22a9b8f259e4b009fe Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Wed, 15 Oct 2008 19:54:35 +0000 Subject: [PATCH] fix the always-on thousands comma --- Ledger/Amount.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Ledger/Amount.hs b/Ledger/Amount.hs index d8c3b2183..8f47c4314 100644 --- a/Ledger/Amount.hs +++ b/Ledger/Amount.hs @@ -48,12 +48,13 @@ instance Show Amount where show = showAmount -- | Get the string representation of an amount, based on its commodity's -- display settings. showAmount :: Amount -> String -showAmount (Amount (Commodity {symbol=sym,side=side,spaced=spaced,precision=p}) q) +showAmount (Amount (Commodity {symbol=sym,side=side,spaced=spaced,comma=comma,precision=p}) q) | side==L = printf "%s%s%s" sym space quantity | side==R = printf "%s%s%s" quantity space sym where space = if spaced then " " else "" - quantity = punctuatethousands $ printf ("%."++show p++"f") q + quantity = commad $ printf ("%."++show p++"f") q + commad = if comma then punctuatethousands else id -- | Add thousands-separating commas to a decimal number string punctuatethousands :: String -> String