hledger/hledger-lib/Hledger/Read
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
..
Common.hs lib: Include sign in TotalPrice in Amount, rather than relying on the sign of 2021-02-23 14:54:39 -08:00
CsvReader.hs lib,cli,ui,bin: Create a new API for MixedAmount arithmetic. This should 2021-03-18 09:47:21 +11:00
JournalReader.hs lib,cli,ui: Replace some uses of String with Text, get rid of some unpacks, clean up showMixed options. 2021-01-02 15:08:09 +11:00
LedgerReader.hs.disabled debug: move command parsing debug output down to level 8 2020-07-03 11:37:01 -07:00
TimeclockReader.hs lib: Change skipMany spacenonewline to takeWhileP Nothing isNonNewlineSpace. 2020-07-22 14:58:53 -07:00
TimedotReader.hs lib: refactor: more consistent amount precision helpers 2021-02-05 16:09:49 -08:00