| 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. | ||
|---|---|---|
| .. | ||
| Hledger | ||
| other/ledger-parse | ||
| test | ||
| Text | ||
| .date.m4 | ||
| .ghci | ||
| .version | ||
| .version.m4 | ||
| CHANGES.md | ||
| hledger-lib.cabal | ||
| Hledger.hs | ||
| LICENSE | ||
| package.yaml | ||
| README.md | ||
| Setup.hs | ||
hledger-lib
A reusable library containing hledger’s core functionality. This is used by most hledger* packages so that they support the same common file formats, command line options, reports etc.
See also: the project README and home page.