hledger/hledger-lib
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
..
Hledger lib,cli,ui,bin: Create a new API for MixedAmount arithmetic. This should 2021-03-18 09:47:21 +11:00
other/ledger-parse lib: restrict imports, avoiding GHCI clashes 2016-11-20 10:27:16 -08:00
test ci: --pedantic is too much for now 2020-03-07 14:53:12 -08:00
Text lib: Rename alignCell to textCell, minor cleanups. 2021-01-15 12:56:48 -08:00
.date.m4 ;tools: split defs.m4 to minimise manual rebuilding 2020-12-15 09:39:29 -08:00
.ghci tools: .ghci for each package, sets shorter prompt 2016-04-15 16:06:45 -07:00
.version ;bump version to 1.21.99 2021-03-10 13:50:49 -08:00
.version.m4 ;bump version to 1.21.99 2021-03-10 13:50:49 -08:00
CHANGES.md ;finalise changelogs 2021-03-10 11:10:13 -08:00
hledger-lib.cabal ;update cabal files 2021-03-12 06:59:30 -08:00
Hledger.hs rename easytests_* to tests_* 2018-09-06 13:13:26 -07:00
LICENSE split off hledger-lib package, containing core types & utils 2010-03-22 01:44:59 +00:00
package.yaml bump base upper bound to allow GHC 9.0 2021-03-12 06:58:46 -08:00
README.md ;doc: more tweaks to package readmes, hackage descriptions 2020-03-22 10:49:02 -07:00
Setup.hs Revert "remove Setup.hs files again, fixing a yesod devel warning" 2014-05-24 13:39:09 -07:00

hledger-lib

A reusable library containing hledgers 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.