hledger/hledger-lib/Hledger/Data
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
..
Account.hs lib,cli,ui,bin: Create a new API for MixedAmount arithmetic. This should 2021-03-18 09:47:21 +11:00
AccountName.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
Amount.hs lib,cli,ui,bin: Create a new API for MixedAmount arithmetic. This should 2021-03-18 09:47:21 +11:00
Commodity.hs new price search that really finds the shortest path (#1443) 2021-01-04 18:42:51 -08:00
Dates.hs lib,cli,ui: Use Text for showDate and related. 2021-01-02 15:08:09 +11:00
Journal.hs lib,cli,ui,bin: Create a new API for MixedAmount arithmetic. This should 2021-03-18 09:47:21 +11:00
Json.hs cli: Using Text Builder for posting reports. 2021-01-02 15:08:09 +11:00
Ledger.hs lib,cli,ui,web: Make Regexp a wrapper for Regex. 2020-08-31 12:04:45 +10:00
Period.hs lib,cli,ui: Use Text for showDate and related. 2021-01-02 15:08:09 +11:00
PeriodicTransaction.hs lib,cli: Make showTransaction return Text rather than String. 2021-01-02 15:08:09 +11:00
Posting.hs lib,cli,ui,bin: Create a new API for MixedAmount arithmetic. This should 2021-03-18 09:47:21 +11:00
RawOptions.hs check: support quoted check name + args 2020-11-29 20:48:31 -08:00
StringFormat.hs lib: Remove unused optional width argument for StringFormat. 2021-01-02 15:08:09 +11:00
Timeclock.hs lib,cli: Assorted fixes for older GHC. 2021-01-02 15:08:09 +11:00
Transaction.hs lib,cli,ui,bin: Create a new API for MixedAmount arithmetic. This should 2021-03-18 09:47:21 +11:00
TransactionModifier.hs lib: (amount|mixedAmount)(Looks|Is)Zero functions now check whether 2021-02-23 14:54:39 -08:00
Types.hs lib: Make fields of Amount, AmountPrice, AmountStyle, and DigitGroupStyle strict. 2021-02-23 14:54:39 -08:00
Valuation.hs cli: rename --infer-value to --infer-market-price 2021-02-05 15:16:39 -08:00