A reusable library containing hledger's core functionality.
This is used by most hledger* packages for common data parsing,
command line option handling, reporting etc.


API-ish changes in the hledger-lib package.
See also the hledger and project change logs (for user-visible changes).

# 1.2 (2016/3/31)

## journal format

A pipe character can optionally be used to delimit payee names in
transaction descriptions, for more accurate querying and pivoting by
payee. Eg, for a description like `payee name | additional notes`,
the two parts will be accessible as pseudo-fields/tags named `payee`
and `note`.

Some journal parse errors now show the range of lines involved, not just the first.

## ledger format

The experimental `ledger:` reader based on the WIP ledger4 project has
been disabled, reducing build dependencies.

## Misc

Fix a bug when tying the knot between postings and their parent transaction, reducing memory usage by about 10% (#483) (Mykola Orliuk)

Fix a few spaceleaks (#413) (Moritz Kiefer)

Add Ledger.Parse.Text to package.yaml, fixing a potential build failure.

Allow megaparsec 5.2 (#503)

Rename optserror -> usageError, consolidate with other error functions

# 1.1 (2016/12/31)

## journal format

- balance assignments are now supported (#438, #129, #157, #288)

This feature also brings a slight performance drop (~5%);
optimisations welcome.

- also recognise `*.hledger` files as hledger journal format

## ledger format

- use ledger-parse from the ledger4 project as an alternate reader for C++ Ledger journals

The idea is that some day we might get better compatibility with Ledger files this way.
Right now this reader is not very useful and will be used only if you explicitly select it with a `ledger:` prefix.
It parses transaction dates, descriptions, accounts and amounts, and ignores everything else.
Amount parsing is delegated to hledger's journal parser, and malformed amounts might be silently ignored.

This adds at least some of the following as new dependencies for hledger-lib:
parsers, parsec, attoparsec, trifecta.

## misc

- update base lower bound to enforce GHC 7.10+

hledger-lib had a valid install plan with GHC 7.8, but currently requires GHC 7.10 to compile.
Now we require base 4.8+ everywhere to ensure the right GHC version at the start.

- Hledger.Read api cleanups

- rename dbgIO to dbg0IO, consistent with dbg0, and document a bug in dbg*IO

- make readJournalFiles [f] equivalent to readJournalFile f (#437)

- more general parser types enabling reuse outside of IO (#439)

# 1.0.1 (2016/10/27)

- allow megaparsec 5.0 or 5.1

# 1.0 (2016/10/26)

## timedot format

- new "timedot" format for retroactive/approximate time logging.

Timedot is a plain text format for logging dated, categorised
quantities (eg time), supported by hledger. It is convenient
for approximate and retroactive time logging, eg when the
real-time clock-in/out required with a timeclock file is too
precise or too interruptive. It can be formatted like a bar
chart, making clear at a glance where time was spent.

## timeclock format

- renamed "timelog" format to "timeclock", matching the emacs package

- sessions can no longer span file boundaries (unclocked-out

sessions will be auto-closed at the end of the file).

- transaction ids now count up rather than down (#394)

- timeclock files no longer support default year directives

- removed old code for appending timeclock transactions to journal transactions.

A holdover from the days when both were allowed in one file.

## csv format

- fix empty field assignment parsing, rule parse errors after megaparsec port (#407) (Hans-Peter Deifel)

## journal format

- journal files can now include timeclock or timedot files (#320)

(but not yet CSV files).

- fixed an issue with ordering of same-date transactions included from other files

- the "commodity" directive and "format" subdirective are now supported, allowing

full control of commodity style (#295) The commodity directive's
format subdirective can now be used to override the inferred
style for a commodity, eg to increase or decrease the
precision. This is at least a good workaround for #295.

- Ledger-style "apply account"/"end apply account" directives are now used to set a default parent account.

- the Ledger-style "account" directive is now accepted (and ignored).

- bracketed posting dates are more robust (#304)

Bracketed posting dates were fragile; they worked only if you
wrote full 10-character dates. Also some semantics were a bit
unclear. Now they should be robust, and have been documented
more clearly. This is a legacy undocumented Ledger syntax, but
it improves compatibility and might be preferable to the more
verbose "date:" tags if you write posting dates often (as I do).
Internally, bracketed posting dates are no longer considered to
be tags. Journal comment, tag, and posting date parsers have
been reworked, all with doctests.

- balance assertion failure messages are clearer

- with --debug=2, more detail about balance assertions is shown.

## misc

- file parsers have been ported from Parsec to Megaparsec \o/ (#289, #366) (Alexey Shmalko, Moritz Kiefer)

- most hledger types have been converted from String to Text, reducing memory usage by 30%+ on large files

- file parsers have been simplified for easier troubleshooting (#275).

The journal/timeclock/timedot parsers, instead of constructing
opaque journal update functions which are later applied to build
the journal, now construct the journal directly by modifying the
parser state. This is easier to understand and debug. It also
rules out the possibility of journal updates being a space
leak. (They weren't, in fact this change increased memory usage
slightly, but that has been addressed in other ways). The
ParsedJournal type alias has been added to distinguish
"being-parsed" journals and "finalised" journals.

- file format detection is more robust.

The Journal, Timelog and Timedot readers' detectors now check
each line in the sample data, not just the first one. I think the
sample data is only about 30 chars right now, but even so this
fixed a format detection issue I was seeing.
Also, we now always try parsing stdin as journal format (not just sometimes).

- all file formats now produce transaction ids, not just journal (#394)

- git clone of the hledger repo on windows now works (#345)

- added missing benchmark file (#342)

- our stack.yaml files are more compatible across stack versions (#300)

- use newer file-embed to fix ghci working directory dependence (<https://github.com/snoyberg/file-embed/issues/18>)

- report more accurate dates in account transaction report when postings have their own dates

(affects hledger-ui and hledger-web registers).
The newly-named "transaction register date" is the date to be
displayed for that transaction in a transaction register, for
some current account and filter query. It is either the
transaction date from the journal ("transaction general date"),
or if postings to the current account and matched by the
register's filter query have their own dates, the earliest of
those posting dates.

- simplify account transactions report's running total.

The account transactions report used for hledger-ui and -web
registers now gives either the "period total" or "historical
total", depending strictly on the --historical flag. It doesn't
try to indicate whether the historical total is the accurate
historical balance (which depends on the user's report query).

- reloading a file now preserves the effect of options, query arguments etc.

- reloading a journal should now reload all included files as well.

- the Hledger.Read.\* modules have been reorganised for better reuse.

Hledger.Read.Utils has been renamed Hledger.Read.Common
and holds low-level parsers & utilities; high-level read
utilities are now in Hledger.Read.

- clarify amount display style canonicalisation code and terminology a bit.

Individual amounts still have styles; from these we derive
the standard "commodity styles". In user docs, we might call
these "commodity formats" since they can be controlled by the
"format" subdirective in journal files.

- Journal is now a monoid

- expandPath now throws a proper IO error

- more unit tests, start using doctest

0.27 (2015/10/30)

- The main hledger types now derive NFData, which makes it easier to
time things with criterion.

- Utils has been split up more.

- Utils.Regex: regular expression compilation has been memoized, and
memoizing versions of regexReplace[CI] have been added, since
compiling regular expressions every time seems to be quite
expensive (#244).

- Utils.String: strWidth is now aware of multi-line strings (#242).

- Read: parsers now use a consistent p suffix.

- New dependencies: deepseq, uglymemo.

- All the hledger packages' cabal files are now generated from
simpler, less redundant yaml files by hpack, in principle. In
practice, manual fixups are still needed until hpack gets better,
but it's still a win.

0.26 (2015/7/12)

- allow year parser to handle arbitrarily large years
- Journal's Show instance reported one too many accounts
- some cleanup of debug trace helpers
- tighten up some date and account name parsers (don't accept leading spaces; hadddocks)
- drop regexpr dependency

0.25.1 (2015/4/29)

- support/require base-compat >0.8 (#245)

0.25 (2015/4/7)

- GHC 7.10 compatibility (#239)

0.24.1 (2015/3/15)

- fix JournalReader "ctx" compilation warning
- add some type signatures in Utils to help make ghci-web

0.24 (2014/12/25)

- fix combineJournalUpdates folding order
- fix a regexReplaceCI bug
- fix a splitAtElement bug with adjacent separators
- mostly replace slow regexpr with regex-tdfa (fixes #189)
- use the modern Text.Parsec API
- allow transformers 0.4*
- regexReplace now supports backreferences
- Transactions now remember their parse location in the journal file
- export Regexp types, disambiguate CsvReader's similarly-named type
- export failIfInvalidMonth/Day (fixes #216)
- track the commodity of zero amounts when possible
(useful eg for hledger-web's multi-commodity charts)
- show posting dates in debug output
- more debug helpers

0.23.3 (2014/9/12)

- allow transformers 0.4*

0.23.2 (2014/5/8)

- postingsReport: also fix date sorting of displayed postings (#184)

0.23.1 (2014/5/7)

- postingsReport: with disordered journal entries, postings before the
report start date could get wrongly included. (#184)

0.23 (2014/5/1)

- orDatesFrom -> spanDefaultsFrom

0.22.2 (2014/4/16)

- display years before 1000 with four digits, not three
- avoid pretty-show to build with GHC < 7.4
- allow text 1.1, drop data-pprint to build with GHC 7.8.x

0.22.1 (2014/1/6) and older: see http://hledger.org/release-notes or doc/CHANGES.md.
comments powered byDisqus