amount cleanups

This commit is contained in:
Simon Michael 2011-01-19 23:27:11 +00:00
parent b159f74a4c
commit 137cc8292e

View File

@ -45,6 +45,8 @@ module Hledger.Data.Amount (
convertMixedAmountTo, convertMixedAmountTo,
costOfAmount, costOfAmount,
costOfMixedAmount, costOfMixedAmount,
divideAmount,
divideMixedAmount,
isNegativeMixedAmount, isNegativeMixedAmount,
isReallyZeroMixedAmountCost, isReallyZeroMixedAmountCost,
isZeroMixedAmount, isZeroMixedAmount,
@ -54,6 +56,8 @@ module Hledger.Data.Amount (
nullamt, nullamt,
nullmixedamt, nullmixedamt,
punctuatethousands, punctuatethousands,
setAmountPrecision,
setMixedAmountPrecision,
showMixedAmount, showMixedAmount,
showMixedAmountDebug, showMixedAmountDebug,
showMixedAmountOrZero, showMixedAmountOrZero,
@ -189,6 +193,7 @@ showAmount' (Amount (Commodity {decimalpoint=d,precision=p,separator=s,separator
| otherwise = printf ("%."++show p++"f") q | otherwise = printf ("%."++show p++"f") q
-- isint n = fromIntegral (round n) == n -- isint n = fromIntegral (round n) == n
-- | A special precision value meaning show all available digits.
maxprecision = 999999 maxprecision = 999999
-- | Replace a number string's decimal point with the specified character, -- | Replace a number string's decimal point with the specified character,
@ -273,8 +278,8 @@ isReallyZeroMixedAmountCost = isReallyZeroMixedAmount . costOfMixedAmount
showMixedAmount :: MixedAmount -> String showMixedAmount :: MixedAmount -> String
showMixedAmount m = vConcatRightAligned $ map show $ amounts $ normaliseMixedAmount m showMixedAmount m = vConcatRightAligned $ map show $ amounts $ normaliseMixedAmount m
-- setMixedAmountPrecision :: Int -> MixedAmount -> MixedAmount setMixedAmountPrecision :: Int -> MixedAmount -> MixedAmount
-- setMixedAmountPrecision p (Mixed as) = Mixed $ map (setAmountPrecision p) as setMixedAmountPrecision p (Mixed as) = Mixed $ map (setAmountPrecision p) as
-- | Get the string representation of a mixed amount, showing each of its -- | Get the string representation of a mixed amount, showing each of its
-- component amounts with the specified precision, ignoring their -- component amounts with the specified precision, ignoring their