From 4cb2a03f7f07c0b065e1540fd083c8ec4f8bb89b Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Mon, 18 Nov 2019 17:22:42 -0800 Subject: [PATCH] ;lib: more docs for unifyMixedAmount [ci skip] --- hledger-lib/Hledger/Reports/BalanceReport.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hledger-lib/Hledger/Reports/BalanceReport.hs b/hledger-lib/Hledger/Reports/BalanceReport.hs index 9730950f4..1afeefe7f 100644 --- a/hledger-lib/Hledger/Reports/BalanceReport.hs +++ b/hledger-lib/Hledger/Reports/BalanceReport.hs @@ -196,6 +196,10 @@ brNegate (is, tot) = (map brItemNegate is, -tot) brItemNegate (a, a', d, amt) = (a, a', d, -amt) -- | Helper to unify a MixedAmount to a single commodity value. +-- Like normaliseMixedAmount, this consolidates amounts of the same commodity +-- and discards zero amounts; but this one insists on simplifying to +-- a single commodity, and will throw a program-terminating error if +-- this is not possible. unifyMixedAmount :: MixedAmount -> Amount unifyMixedAmount mixedAmount = foldl combine (num 0) (amounts mixedAmount) where