hledger/hledger-lib/Hledger/Reports
Stephen Morgan dabb3ef82e lib,cli,ui,bin: Create a new API for MixedAmount arithmetic. This should
supplant the old interface, which relied on the Num typeclass.

MixedAmount did not have a very good Num instance. The only functions
which were defined were fromInteger, (+), and negate. Furthermore, it
was not law-abiding, as 0 + a /= a in general. Replacements for used
functions are:
0 -> nullmixedamt / mempty
(+) -> maPlus / (<>)
(-) -> maMinus
negate -> maNegate
sum -> maSum
sumStrict -> maSum

Also creates some new constructors for MixedAmount:
mixedAmount :: Amount -> MixedAmount
maAddAmount :: MixedAmount -> Amount -> MixedAmount
maAddAmounts :: MixedAmount -> [Amount] -> MixedAmount

Add Semigroup and Monoid instances for MixedAmount.
Ideally we would remove the Num instance entirely.

The only change needed have nullmixedamt/mempty substitute for
0 without problems was to not squash prices in
mixedAmount(Looks|Is)Zero. This is correct behaviour in any case.
2021-03-18 09:47:21 +11:00
..
AccountTransactionsReport.hs lib,cli,ui,bin: Create a new API for MixedAmount arithmetic. This should 2021-03-18 09:47:21 +11:00
BalanceReport.hs lib,cli,ui,bin: Create a new API for MixedAmount arithmetic. This should 2021-03-18 09:47:21 +11:00
BudgetReport.hs lib,cli,ui,bin: Create a new API for MixedAmount arithmetic. This should 2021-03-18 09:47:21 +11:00
EntriesReport.hs lib,cli,ui: Separate costing from valuation; each can now be specified 2021-01-28 13:57:48 -08:00
MultiBalanceReport.hs lib,cli,ui,bin: Create a new API for MixedAmount arithmetic. This should 2021-03-18 09:47:21 +11:00
PostingsReport.hs lib,cli,ui,bin: Create a new API for MixedAmount arithmetic. This should 2021-03-18 09:47:21 +11:00
ReportOptions.hs lib: Do not do any valuation with --value=cost, perform AtEnd valuation with --value=cost,COMM. 2021-03-10 12:42:01 +11:00
ReportTypes.hs lib,cli,ui,bin: Create a new API for MixedAmount arithmetic. This should 2021-03-18 09:47:21 +11:00
TransactionsReport.hs lib,cli,ui,bin: Create a new API for MixedAmount arithmetic. This should 2021-03-18 09:47:21 +11:00