Commit Graph

1286 Commits

Author SHA1 Message Date
Simon Michael
1ebf1fec28 timedot: also provide syntax for seconds, days, weeks, months & years 2017-08-21 17:28:57 -07:00
Simon Michael
5cdb60b69b timedot: allow minutes to be logged as Nm 2017-08-20 13:00:29 -07:00
Simon Michael
16c07c537b csv: also switch which posting is converted to cost
After switching the postings, make sure it's the second which is converted
to cost.
2017-08-15 08:40:52 -07:00
Simon Michael
501634d2e9 doc: journal: makeinfo-version-related encoding change, hopefully correct 2017-08-15 08:18:06 -07:00
Simon Michael
cd589a5e4e doc: csv: improve CSV conversion tips
[ci skip]
2017-08-15 08:17:15 -07:00
Simon Michael
ce5724fee1 csv: switch the order of generated postings, so account1 is first
This is subjective, but simplifies things as we'll be adding more than
two postings. Free-form entry templates will allow custom orderings
in future.
2017-08-15 08:16:49 -07:00
Mark Hansen
e98d213ca2 Add link to Visual Studio Code hledger plugin 2017-08-02 05:37:26 -07:00
Simon Michael
cb0cb1e1e1 regenerate embedded manuals 2017-07-31 15:52:41 -07:00
Simon Michael
1efbbbc7ac regenerate cabal files 2017-07-31 15:01:23 -07:00
Simon Michael
5706353881 bump version strings & lower bounds to 1.3.99 2017-07-31 14:02:35 -07:00
Simon Michael
f4acef58b1 lib: doctests: refactor, include Text.* 2017-07-31 07:09:57 -07:00
Simon Michael
20442196fb lib: refactor 2017-07-31 07:09:06 -07:00
Simon Michael
f1c5cce575 lib: another doctests fix, replace wrong haddock char 2017-07-31 07:09:06 -07:00
Simon Michael
dbef13b13f lib: more consistent deps, fixing doctests with Cabal 2 (fixes #596) 2017-07-31 07:09:06 -07:00
Simon Michael
ecfc8224dd lib: cleanup up megaparsec 6 compat module, simplify error type (#594) 2017-07-28 07:53:02 -07:00
Simon Michael
d7d5f8a064 add support for megaparsec 6 (fixes #594)
Older megaparsec is still supported.
Also cleans up our custom parser types,
and some text (un)packing is done in different places
(possible performance impact).
2017-07-27 19:20:46 -07:00
Simon Michael
8851ebc29f bs/cf/is: support --output-file and --output-format=txt|csv
The CSV output should be reasonably ok for dragging into
a spreadsheet and reformatting.
2017-07-25 19:43:45 -07:00
Simon Michael
8313695306 doc: journal: update sample in generated manuals 2017-07-24 22:19:25 +01:00
Nicholas Niro
93fbc0e989 lib: Fix of a bug with the -H option.
This patch fixes a bug that happened when using the -H option on
a period without any transaction. Previously, the behavior was no
output at all even though it should have shown the previous ending balances
of past transactions. (This is similar to previously using -H with -E,
but with the extra advantage of not showing empty accounts)
2017-07-15 08:02:03 +01:00
Nicholas Niro
f0914ff08e lib: Added a new much more thorough test to MultiBalanceReports.
This test makes sure that -H works correctly and it does not show
empty accounts.
2017-07-15 08:02:03 +01:00
Nicholas Niro
9873bcfcba lib: Added a new transaction to samplejournal.
The new entry effectively adds a loan which is placed in the checking account.
This loan is then closed by the "pay off" transaction (which was already
present).

This is mainly to be used as a test point for the -H option; to make
sure -H does not show empty accounts.

All previous tests were changed to reflect the new change.
The documentation of the journal module was updated too.
2017-07-15 08:02:03 +01:00
Nicholas Niro
a7f6b551c5 lib: Implemented a testing context for the module MultiBalanceReports.
Of the 2 tests, the first is a simple test on a specific period.
The second is expected to fail at this point until the new upcoming
code to fix the issue with the history option is implemented.

For the record : this issue happens when we use the -H flag for a period
that does not contain any transactions. Currently, the ending balance
values are only taken into account if the current period contains
a Transaction containing one of the previous populated accounts.

For example, if we have a statement on the 2008/01/01 for $1
and we do a command (with -H) to check the value on the
(without transactions) 2008/01/02, we will not get the $1 from
2008/01/01. In that same example, if we had a transaction for the same
account as 2008/01/01 in say 2008/01/03 then the -H command would
successfully show the statement from 2008/01/03 with the initial amount
that we set in 2008/01/01.
2017-07-15 08:02:03 +01:00
Nicholas Niro
fe2a1b35da lib: Added 2 new tests to BalanceReport.
These tests verify the behavior when we input a very specific period.
The second test is meant to make sure that the new upcoming code in
MultiBalanceReports will not change anything in the behavior of
the module BalanceReport.
2017-07-15 08:02:03 +01:00
Nicholas Niro
a204908be6 lib: Added a comment to explain the type MultiBalanceReportTotals 2017-07-15 08:02:03 +01:00
Simon Michael
ee735514fe doc: update builtin manuals 2017-07-07 02:08:38 +01:00
Simon Michael
b3b33336b4 csv: show the "creating/using rules file" message only with --debug 2017-07-06 14:07:46 +01:00
Simon Michael
e94f04311d csv: fix multiple includes in one rules file 2017-07-05 16:08:13 +01:00
Simon Michael
6614aab5d7 csv: add newest-first directive for more robust same-day ordering 2017-07-05 15:24:17 +01:00
Simon Michael
5ce66fb0de doc, site: final 1.3 changelogs, release notes, announcement
[ci skip]
2017-07-01 18:56:57 +01:00
Simon Michael
28c420109d doc: changelogs for 1.3 2017-06-30 22:26:36 +01:00
Simon Michael
af952532c9 bump package versions to 1.3 2017-06-30 20:57:47 +01:00
Simon Michael
c4248072db doc: bump version to 1.3, update builtin manuals 2017-06-30 20:45:50 +01:00
Simon Michael
1d5f3a44d5 lib: debug: add a log0 that writes to debug.log in the current directory
Seems to work somewhat, might have some laziness issues.
2017-06-30 19:14:57 +01:00
Simon Michael
41d62d669b doc: journal: note that transaction code must be parenthesised 2017-06-30 14:49:19 +01:00
David Reaver
a9959b30c2 Fix date of 1.2 release in CHANGES 2017-06-20 08:45:35 -07:00
Simon Michael
59af88b796 ui: add temporary --status-toggles for testing toggle styles (#564) 2017-06-18 16:20:30 -07:00
Simon Michael
22e751983b ui: allow multiple status filters to be active at once (#564) 2017-06-15 19:16:39 -07:00
Simon Michael
dcc58d4a2b lib: rename ClearedStatus type to Status
(and fix hard-coded enum count)
2017-06-15 19:16:39 -07:00
Simon Michael
430c49154a lib: rename Query's Status constructor to StatusQ 2017-06-15 19:16:39 -07:00
Simon Michael
cca95d2974 doc: update builtin manuals 2017-06-15 19:16:39 -07:00
Simon Michael
e119941648 rename "uncleared" status to "unmarked" and --uncleared to --unmarked (#564)
See the issue and linked mail list discussion. Ambiguity between the
uncleared state, and the "not cleared" --uncleared flag causes confusion
and friction. At this point it seems best to break with Ledger and
past hledger, pick a new name and drop --uncleared to put an end to it.
2017-06-15 19:16:39 -07:00
Simon Michael
794647780d doc: fixes for builtin manuals 2017-06-15 19:16:39 -07:00
Simon Michael
d0771a8526 doc: regenerate builtin manuals 2017-06-15 19:16:39 -07:00
Simon Michael
f168d74010 doc: update status docs 2017-06-15 19:16:39 -07:00
Simon Michael
5d28120f6d lib: multiple status: query terms are OR'd (#564)
Like desc: and acct:. I think this is more intuitive and useful,
so now eg "status: status:!" works (equivalent to -UP or "not:status:*").
2017-06-15 19:16:39 -07:00
Simon Michael
7fc921db86 lib, cli: -U/-P/-C flags can be combined (#564) 2017-06-15 19:16:39 -07:00
Simon Michael
8b073014e4 lib, cli: -U/--uncleared no longer matches pending things (#564)
Also begin using "marked"/"unmarked" terminology where it's helpful.
2017-06-15 19:16:39 -07:00
Simon Michael
c5d63f03ce lib: clean up status functional tests, document ClearedStatus (#564) 2017-06-15 19:16:39 -07:00
Simon Michael
dae17093c3 lib: hide successful hunit tests, to avoid obscuring failed doctests (#568) 2017-06-07 06:42:58 -07:00
Carel Fellinger
da9aa81ec7 Update AutoTransaction.hs
lib: fix unit test some more after 5c095534
2017-06-07 12:56:43 +02:00
Simon Michael
7cc2d86ac0 lib: fix unit tests after 5c095534 2017-06-06 09:43:05 -07:00
Simon Michael
1755f71202 bump version/month in all generated docs 2017-06-06 09:22:39 -07:00
Simon Michael
af11cd6243 bump package versions to 1.2.98 (1.3 alpha) 2017-06-06 09:21:51 -07:00
Simon Michael
5c09553481 lib: keep amounts aligned when rendering a transaction with posting flags
Related to #563, when rendering a transaction, we reserve two more chars
of width so that amounts remain aligned when there are posting flags.
Affects hledger-ui's transaction screen, print, hledger-rewrite etc.
2017-06-04 21:26:18 -07:00
Simon Michael
1adc636554 lib: show pending posting flags when rendering a transaction (fix #563)
This affects hledger-ui's transaction screen, print, hledger-rewrite etc.
A pending flag on postings is now displayed, just like a cleared flag.
Also there will now be a space between flag and account name.
And it's slightly better at aligning amounts, due to now considering
virtual posting parentheses/brackets or something.
2017-06-04 17:54:57 -07:00
Simon Michael
c9e7bbdc7c clarify recent print changes a bit (#551) 2017-05-30 13:57:52 -07:00
Simon Michael
aca7c0d93b lib: clarify journalBalanceTransactions 2017-05-30 13:57:52 -07:00
Christian G. Warden
d39040c634 Add Support for Rewriting Multipler Postings Into Different Commodities (#557)
When generating a new posting as a multiple of an existing posting,
support conversion to a different commodity.  For example, postings in
hours can be used to generate postings in USD.

Automatic transactions generated from rewrite rules use the commodity,
amount style, and transaction price if the rewrite defines a commodity.
2017-05-30 07:30:15 -07:00
Joe Horsnell
35f77ee5e4 Fix trivial typo (#balance-assertions anchor) in CSV docs. (#559) 2017-05-30 07:27:14 -07:00
Simon Michael
dca7ffc10b doc: journal: meaning of --uncleared, matching tips (#553)
[ci skip]
2017-05-24 19:17:29 -07:00
Simon Michael
34af40024a doc: journal: expand transactions/postings/status sections (#553) 2017-05-24 17:44:32 -07:00
Simon Michael
a5b545c4eb doc: clarify some transaction price details
- remove inaccurate print examples
- note #551
- note Ledger's fixed price syntax
- note how posting order can affect -B
- edits for clarity
2017-05-22 17:52:14 -07:00
Jan Zerebecki
f403b1e709 Fix link to queries (#550) 2017-05-22 07:29:55 -07:00
Simon Michael
5e00d2f31c csv: refactor (#548) 2017-05-14 18:17:56 +09:00
Nicolas Wavrant
309d1ccd59 CsvReader: simplify '-' signs if there exist more than one (#548)
It prevents hledger to crash later, as it fails to read
amount strings containing more than one '-'

Fix #524
2017-05-14 09:34:33 +09:00
Simon Michael
2de0109953 allow megaparsec 5.3 2017-04-29 17:16:27 -07:00
Simon Michael
10d85bedec bal: show negative amounts in red
The balance command now shows negative amounts in red, when it thinks
ANSI codes are supported, ie when TERM is not "dumb" and stdout is not
being redirected or piped somewhere.
2017-04-25 18:34:09 -07:00
Simon Michael
9a86c9ee52 lib: begin supporting colour
Add some basic helpers for working with ANSI colour codes,
and make strWidth and the various string layout functions aware of them.
2017-04-25 18:27:25 -07:00
Simon Michael
48a84cdd58 lib: note an issue with journalfieldnames ordering 2017-04-19 09:05:21 -07:00
Simon Michael
2ac77338f8 doc: csv tweaks 2017-04-19 09:04:44 -07:00
Dmitry Astapov
c4c4be5fad Fix parsing of blank/empty balances + testcases (#539) 2017-04-18 09:07:30 -07:00
Dmitry Astapov
451f9d7307 "balance" parser for csv reader (#537)
* "balance" parser for csv reader

* Some docs for
2017-04-14 14:52:03 -07:00
Simon Michael
f9ad13b1c1 doc: journal: drop obsolete info 2017-04-13 08:42:52 -07:00
Simon Michael
d9488ea01b doc: move cost/market value into general options section
[ci skip]
2017-03-31 19:18:17 -07:00
Simon Michael
ff598f2635 doc: make changelogs from release notes 2017-03-31 18:11:44 -07:00
Simon Michael
6ee66979ff doc: regenerate files 2017-03-31 18:01:32 -07:00
Simon Michael
1850fb732f bump version to 1.2 2017-03-31 17:58:11 -07:00
Simon Michael
646cdf34e2 lib: mark todo for multicolumn balance/bs (#518) 2017-03-31 16:55:04 -07:00
Simon Michael
61a5b5274b doc: journal: fix link to aliases howto
[ci skip]
2017-03-31 10:42:53 -07:00
Simon Michael
55fb5424e9 tools: travis: don't doctest ledger-parse 2017-03-30 13:15:50 -07:00
Simon Michael
e8dcef5b5f lib: disable WIP ledger4 parser, lighten dependencies 2017-03-29 21:06:26 -07:00
Moritz Kiefer
f4b3f1c094 Add an option to use unicode in balance tables (#528)
* Add an option to use unicode in balance tables

fixes #522

* Add a test for unicode tables

* Document --pretty-tables

* Support --pretty-tables in BalanceView
2017-03-29 11:12:01 -07:00
Simon Michael
b402fc7e7d lib: optserror -> usageError, consolidate with other error functions (#529) 2017-03-29 08:00:51 -07:00
Simon Michael
59704dcb6b doc: regenerate doc files 2017-03-27 05:12:03 -07:00
Peter Simons
e2c8a6ae42 Use more accurate license tag in Cabal file. 2017-03-15 23:07:57 +00:00
Simon Michael
3c13da3ca2 update cabal files to hpack 0.17.0/stack 1.4 format #512 2017-03-15 23:04:35 +00:00
Simon Michael
ea1f19c71e lib: csv: refactor, allow writing different rules text 2017-02-06 02:34:18 -08:00
Simon Michael
9cfb7bf6af lib: update readJournalFromCsv doc 2017-02-06 01:45:32 -08:00
Simon Michael
7dd34d71b5 ui: transaction: fix pattern match failure when pressing E (fixes #508) 2017-02-05 12:00:45 -08:00
Justin Le
600132445c documentation changed to reflect new bs/is/cf and -V behavior 2017-02-04 16:38:18 -08:00
Justin Le
f47df67167 mapping function over journal amounts 2017-02-04 16:38:18 -08:00
Simon Michael
fa388257d9 add MarketPrice module to other cabal sections #505 2017-02-04 16:32:03 -08:00
Justin Le
6bccb847d5 Added a simple 'showMarketPrice' function to show market price directives in a journal-compatible way (#505)
* added showMarketPrice and Hledger.Data.MarketPrice module

* showMarketPrice implemented using showDate

* attempted to add tests to Hledger.Data.MarketPrice

* moved MarketPrice test to Hledger.Read.JournalReader; fixed documentation on MarketPrice; added MarketPrice module to package.yaml
2017-02-03 18:20:00 -08:00
Simon Michael
a30583f6a1 allow megaparsec 5.2 #503 2017-02-01 16:24:37 -08:00
Bryan Richter
4890d2bf90 Escape account names (#499)
Fixes #498.
2017-01-30 09:17:18 -08:00
Simon Michael
0395543719 doc: journal: market price doc tweak 2017-01-26 14:19:23 -08:00
Mykola Orliuk
3a632acea0 budget: periodic transactions support 2017-01-20 13:42:17 -08:00
Mykola Orliuk
7437c96ff6 Make hledger-rewrite tool suitable for re-factoring original journals (#490)
* cli: fix bug in pivot for postings without tag

Without this fix for postings without tag query checked effective
account which is always empty text ("").

* rewrite: inherit dates, change application order

For budgeting it is important to inherit actual date of posting if it
differs from date of transaction. These dates will be added
as a separate line of comment.

More natural order of rewrites is when result of first defined one is
available for all next rewrites.

* rewrite: factor out Hledger.Data.AutoTransaction

* rewrite: add diff output

With this option you can modify your original files without loosing
inter-transaction comments etc. I.e. you can run:

hledger-rewrite --diff Agency \
  --add-posting 'Expenses:Taxes  *0.17' \
  | patch

As result multiple files should be updated.
Also it is nice to review your changes using colordiff instead of
patch.

* lib: track source lines range for journal

* doc: auto entries and diff output for rewrite
2017-01-20 07:33:24 -08:00
Simon Michael
9759b5c867 doc: clarify tags
[ci skip]
2017-01-16 16:26:51 -08:00
Simon Michael
91dbeedee4 doc: document new --pivot
[ci skip]
2017-01-16 15:53:51 -08:00
Simon Michael
5345e2641a regenerate cabal files with hpack
A few packages which included the Paths_* module no longer do,
and this seems ok with stack and cabal as far as I can tell.
That should be the only change, aside from a bunch of reorderings.
2017-01-16 14:23:47 -08:00
Simon Michael
ce69f17db6 lib: fix a potential build failure: add Ledger.Parse.Text to package.yaml 2017-01-16 13:52:30 -08:00
Mykola Orliuk
3af81a73ca txnTieKnot fix (~10% memory reduce) (#483)
* bin: ignore chart and dupes addons

* lib: fix txnTieKnot

Ensure that postings refers to their transaction rather than original
one.
This should allow compiler perform destructive update and/or allow
garbage collecting old transaction.
2017-01-16 07:42:41 -08:00
Simon Michael
d657374ac4 doc: note an issue with balance assertions & multiple -f options
[ci skip]
2017-01-14 17:49:26 -08:00
Simon Michael
8bc67d5ee8 print: don't lose the commodity in zero balance assertions. Related to #475 2017-01-14 10:29:33 -08:00
Hans-Peter Deifel
dfbb683573 Prettify option parsing errors (#478)
Megaparsec's show instance for ParseError doesn't produce digestible
strings. parseErrorPretty has to be used instead.
2017-01-13 13:10:11 -08:00
Simon Michael
2e61c037c3 cli: --pivot payee/note uses description parts before/after |
This assumes a "PAYEE | NOTE" convention in the description field,
similar to Beancount's journal syntax.  If the description has no pipe
character, payee and note are the same as the full description.
2017-01-13 08:19:42 -08:00
Simon Michael
27d727ffad cli: rename --pivot desc to --pivot description for consistency 2017-01-13 08:05:22 -08:00
Mykola Orliuk
76867c98a3 Feature/pivot implicit tags (#460)
* Add implicit tags code/desc/payee for --pivot

Additionally allow using of transaction inherited tags.

* Use original posting in query by account name

To be able to query on individual postings and by account name it is
useful to have access to original account name (before pivot).
Especially this is useful when all postings within transaction gets
the same pivot name due.
As a side effect we'll match by alias.

Note: to query on amt it usually expected to see matches with inferred
amounts.
2017-01-13 08:02:11 -08:00
Mykola Orliuk
015b764d00 Preserve implicit amounts and prices the way user wrote them in output of print command (#471)
* Remember original postings during infer and pivot

This includes such functions like:
- inferFromAssignment
- inferBalancingAmount
- inferBalancingPrices
- pivotPosting

* Use original postings for hledger print

- Introduce "--explicit" option for "print" command which brings back
  old behavior when every inferred number being printed.
- Make "print" by default print original postings without inferred
  amounts. But use effective account name to have effect from aliases.
- Instruct shell tests with an new expected output or to use
  --explicit option when inferred amounts are checked.

Resolves simonmichael/hledger#442
2017-01-13 07:25:44 -08:00
Moritz Kiefer
d236f7b237 Fix a few spaceleaks (#413) 2017-01-12 16:24:53 -08:00
Nikolay Orlyuk
c0d12f5d1c Normalize amount in infereBalancingAmount (#469)
This fixes issue exposed by a fix for simonmichael/hledger#465
2017-01-11 12:09:07 -08:00
Nikolay Orlyuk
32d9365fc2 Ensure showTransaction produce a valid journal (#466)
- Make output of print to be a valid journal
- Partially reverts 419f5f2a2

Fixes simonmichael/hledger#465
2017-01-10 20:44:10 -08:00
Simon Michael
3ae8712bbc rename data/ to examples/ 2017-01-08 07:26:13 -08:00
Simon Michael
fe457fa12a doc: update built-in docs 2017-01-05 10:43:06 -08:00
Simon Michael
631a95ba9c bump version to 1.1.98 (1.2 alpha) 2017-01-05 10:43:06 -08:00
Simon Michael
dd86596d30 doc: rename _versions_ macro 2017-01-04 10:50:16 -08:00
Simon Michael
20bef095aa doc: changelogs, release notes 2016-12-31 11:24:12 -08:00
Simon Michael
6072f2a8f4 doc: update generated doc files 2016-12-31 11:23:53 -08:00
Simon Michael
14c8e4d8f7 bump version to 1.1 2016-12-31 07:54:47 -08:00
Simon Michael
a1555ce964 Revert "Adding "--value"/"-V" option for balancesheet/incomestatement/cashflow and register (#361)"
This reverts commit b935cd2243.
2016-12-31 07:54:47 -08:00
Justin Le
b935cd2243 Adding "--value"/"-V" option for balancesheet/incomestatement/cashflow and register (#361)
* Added --value options for specialized balance ouputs balancesheet, incomestatement, cashflow

* --value option for 'register' command
lib: postingsValue to convert posting amounts to market value
2016-12-31 07:48:17 -08:00
Simon Michael
78f0c403fb doc: update generated docs 2016-12-30 14:36:27 -08:00
Simon Michael
701fb5496f doc, cli: improvements for -B, -V, prices docs #403 2016-12-30 14:36:27 -08:00
Simon Michael
2b05970781 lib: report end date fix #403 #453 2016-12-30 14:36:27 -08:00
Simon Michael
66fcd0d4b2 lib: show report end date in debug output #403 #453 2016-12-30 14:36:15 -08:00
Simon Michael
1866d2375d bal: with same-date market prices, use the last parsed not the highest price #403 #453 2016-12-30 11:46:13 -08:00
Simon Michael
7dcfcb05ec lib: get effective report start/end dates 2016-12-30 11:46:13 -08:00
Simon Michael
ce8046bdb4 lib: add some debug output for market prices (#453) 2016-12-30 11:15:03 -08:00
Simon Michael
547e6d5438 doc: journal: clarify market prices (#403) 2016-12-29 12:39:39 -08:00
Simon Michael
264e81c430 lib: applyN comment 2016-12-29 11:33:34 -08:00
Simon Michael
f84324682e lib: fix a doctest in Hledger.Data.Dates 2016-12-29 11:33:33 -08:00
Shubham Lagwankar
37b7ebfe22 use isSpace in lstrip (#441) 2016-12-20 09:29:12 -08:00
Simon Michael
47ca1965b2 doc: document balance assignments (#438) 2016-12-10 08:03:56 -08:00
Johannes Gerer
45401e538e Balance Assignments and accounts resetting (#438)
* Changed behavior of `readJournalFiles` to be identical to `readJournalFile` for singleton lists

* Balance Assertions have to be simple Amounts

* Add 'isAssignment' and 'assignmentPostings' to Hledger.Data.Posting and Transaction

* Implemented 'balanceTransactionUpdate', a more general version of 'balanceTransaction' that takes an update function

* Fixed test cases.

* Implemented balance assignment ("resetting a balance")

* Add assertions to show function

* updated the comments

* numbering is not needed in journalCheckBalanceAssertions

* remove prices before balance checks

* rename functions
2016-12-10 07:04:48 -08:00
Johannes Gerer
74502f7e50 more general parser types enabling reuse outside of IO (#439) 2016-12-09 15:57:17 -08:00
Simon Michael
3c4cb4eeeb ui: --watch: track date only when a standard period is in effect 2016-12-07 15:19:36 -08:00
Simon Michael
6aeaee17f5 ui: clarify docs of some period functions 2016-12-07 14:54:23 -08:00
Simon Michael
00e2a8a327 lib: note a problem with dbg*IO 2016-12-07 07:59:48 -08:00
Johannes Gerer
2e8e67aa09 Changed behavior of readJournalFiles to be identical to readJournalFile for singleton lists (#437) 2016-12-07 07:59:24 -08:00
Simon Michael
9952f93e97 ui: --watch date tracking fixes
- move the period only if it's "current" (contains the old "today" date)
- make it work on all screens, not just accounts
2016-12-02 15:36:23 -08:00
Simon Michael
e3a7f6697e ui: --watch also tracks the current date, when appropriate
ie, when viewing a "current" period (the current day/week/month/quarter/year),
it will be moved to enclose the current date, if needed, whenever the system date changes.
2016-12-01 19:26:38 -08:00
Simon Michael
36c75841ee lib: dbgIO -> dbg0IO, consistent with dbg0 2016-11-24 10:59:03 -08:00
Simon Michael
3a5091e9eb don't show stack trace details in errors with GHC 8+ 2016-11-22 14:28:39 -08:00
Simon Michael
a1411768e5 csv: create default rules file only if CSV reader succeeds 2016-11-22 13:59:31 -08:00
Simon Michael
1f2276c100 lib: mark ledger reader as experimental, don't use automatically 2016-11-20 10:42:12 -08:00
Simon Michael
98ef8f9a60 lib, cli: allow a READER: prefix on data file paths
This provides a way to override the file format detection logic,
useful eg for files with wrong extensions or standard input.
2016-11-20 10:32:22 -08:00
Simon Michael
7d56af5a03 lib: restrict imports, avoiding GHCI clashes 2016-11-20 10:27:16 -08:00
Simon Michael
1539b258b9 lib: more Hledger.Read cleanup 2016-11-19 08:57:03 -08:00
Simon Michael
c8fefef7e8 doc: document file reading, and some options cleanups 2016-11-18 13:26:15 -08:00
Simon Michael
b6ff170688 lib: simplify format detection, avoid ledger reader by default
When we don't know a file's format, instead of choosing a subset of
readers based on content sniffing, now we just try them all.
Also, LedgerReader is now used only as a last resort,
as it's not yet competitive with JournalReader.
2016-11-18 13:24:57 -08:00
Simon Michael
59ce4c987b ledger: handle errors better in the ledger reader 2016-11-18 13:18:58 -08:00
Simon Michael
12151e05c0 lib: some Hledger.Read cleanup 2016-11-17 20:20:07 -08:00
Simon Michael
3ddc9d7432 lib: clarify file format detectors 2016-11-16 13:25:33 -08:00
Simon Michael
6a36efb7ca set base lower bound to 4.8 to enforce GHC 7.10+
hledger-lib had a valid install plan with GHC 7.8, but requires GHC 7.10 to compile (currently).
Require base 4.8+ everywhere so that stack/cabal will enforce a supported GHC version early.

Also, bump hledger-ui's "stability" to "stable".
2016-11-16 13:14:02 -08:00
Simon Michael
48b0d8a395 lib: ledger reader debug logging, cleanup 2016-11-13 08:29:04 -08:00
Simon Michael
27dd1ca593 lib: add a basic ledger journal reader using ledger4's ledger-parse
This reader is used by default for files with suffix .ledger or .l,
and tried along with the other readers for files of unknown type.

Currently only the bare minimum of the raw parsed data is used:
transaction dates/descriptions and posting accounts/amounts,
with the rest being ignored.

Amounts are parsed the same way as in the hledger journal format.
Malformed amounts might be ignored instead of error-reported.
2016-11-12 14:22:27 -08:00
Simon Michael
4eb7a617db lib: fix doctests 2016-11-12 14:14:04 -08:00
Simon Michael
6db6f9aa2c lib: fix hunit tests 2016-11-12 14:13:55 -08:00
Simon Michael
2996ec971b lib: also recognise *.hledger as hledger journal format 2016-11-12 13:55:37 -08:00
Simon Michael
c8650e0d10 comment 2016-11-12 13:54:48 -08:00
Simon Michael
2b310029bf file list fixes 2016-11-12 13:53:55 -08:00
Simon Michael
f5ee020b88 lib: add a copy of the ledger4 parser
This adds some or all of these as new dependencies for hledger-lib:
parsers, parsec, attoparsec, trifecta
2016-11-12 10:50:57 -08:00
Simon Michael
f548abf71c lib, doc: remove incorrect speedup claim 2016-10-29 12:13:20 -07:00
Simon Michael
6d0716b0a5 bump packages (excluding hledger-api and docs) to 1.0.1 2016-10-27 08:14:35 -07:00
Simon Michael
2e10f21f26 doc: update changelogs and relnotes outline (but not relnotes page) for 1.0.1 2016-10-27 08:10:24 -07:00
Simon Michael
d0e9b70e4f doc: release note/changelog fixes 2016-10-27 07:43:44 -07:00
Simon Michael
8bc0538778 allow megaparsec 5.0 or 5.1 for stackage compatibility 2016-10-27 07:19:26 -07:00
Simon Michael
08f97dd9c8 doc: project/package change logs, web release notes 2016-10-26 13:34:28 -07:00
Simon Michael
315db5621a doc: bump version to 1.0, update manuals & cabal files 2016-10-26 13:34:27 -07:00
Simon Michael
ee2ced7f65 set an upper bound on megaparsec 2016-10-26 13:34:27 -07:00
Simon Michael
5aa4c91332 stack/cabal cleanups; drop GHC 7.6, 7.8 support
A (disabled) stack build plan for GHC 7.8 is included; supporting it
would need small code changes and a maintainer.
2016-10-21 14:47:22 -07:00
Simon Michael
275f98b3be lib: getCurrentZonedTime 2016-10-21 11:47:07 -07:00
Simon Michael
bdf8f5ca88 doc: update generated docs, fixing typos 2016-10-20 16:57:35 -07:00
Hans-Peter Deifel
ae73c525d8 Fix csv rules parsing (#407)
* csv rules: Show prettier parsing errors

This goes from

  hledger: user error ("ParseError {errorPos = SourcePos {sourceName = \"foo.csv.rules\",
  sourceLine = Pos 20, sourceColumn = Pos 1} :| [], errorUnexpected =
  fromList [Tokens (' ' :| \"\")], errorExpected = fromList [Label ('b' :| \"lank or comment
  line\"),EndOfInput], errorCustom = fromList []}")

to

  hledger: user error (foo.csv.rules:20:1:
  unexpected space
  expecting blank or comment line or end of input
  )

* csv rules: Fix parsing of empty field values

A single line containing `account1 ` (note the space at the end) should
parse as assignment of the empty string to account1. At least it did
until commit 4141067.

The problem is that megaparsec's `space` parses multiple space
characters as opposed to parsec. So in the example above it would
incorrectly consume the newline.

This commit also adds a new test case for this bug.
2016-09-25 12:56:28 -07:00
Simon Michael
86c23bde7f doc: journal: fix posting dates link (fixes #401)
[ci skip]
2016-09-14 06:57:44 -07:00
Simon Michael
233251b06a doc: journal: clarify D directive
Example added, per #399 discussion.
2016-09-13 09:11:08 -07:00
Simon Michael
8c7e7c02c3 ui, lib: another historical balance fix for accountTransactionsReport 2016-09-06 08:43:25 -07:00
Simon Michael
2f4dde3699 lib: debug utils cleanup 2016-09-06 08:31:53 -07:00
Simon Michael
b262be7838 ui: fix wrong register start balance in historical mode
90c0d40 a few weeks ago miscalculated the starting balance
in accountTransactionsReport. Possibly also affects
-web and -api.
2016-09-05 14:45:02 -07:00
Simon Michael
9396bc6711 lib: fix ghc 8 warnings in Read.Common 2016-09-05 14:31:56 -07:00
Simon Michael
4ceda8f985 timeclock: fix order of transaction indexes #394
Timeclock transaction ids now count up rather than down.

Also, remove old code for appending timeclock transactions to journal transactions,
a holdover from the days when both were allowed in one file.
2016-08-14 14:50:03 -07:00
Simon Michael
72c39470d6 lib: non-journal formats now produce transaction ids #394
Transactions are now numbered consistently during journal finalisation,
rather than just in the journal reader. Also transaction knot-tying has been
moved out of journalBalanceTransactions.
2016-08-14 12:44:19 -07:00
Simon Michael
a4cf233312 ui: keep next/previous period within the journal's date span 2016-08-13 08:08:43 -07:00
Simon Michael
f3bcf570e5 lib: simplify account txns report 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 tell the user
whether the historical total is the accurate historical balance (which
depends on the report query).
2016-08-12 17:26:34 -07:00
Simon Michael
69ebc3b159 bal, reg, stats: clarify report modes, output, options
- try to clarify naming and meaning of balance/register report modes
  and kinds of "balance" displayed. Added balance --change and
  register --cumulative flags to clarify report modes.

- with multiple --change/--cumulative/--historical flags use the last
  instead of complaining

- register -A is now affected by -H

- options cleanups
2016-08-12 09:44:31 -07:00
Simon Michael
c1ddbfc08a drop unusual "d" suffix when showing a day period 2016-08-11 11:23:05 -07:00
Simon Michael
79cc999fa3 ui: d/u zooms report period down/up, t selects today 2016-08-09 15:31:35 -07:00
Simon Michael
15ebae5c5f lib, cli, web: try to fix building with GHC 7.4 2016-08-09 12:22:38 -07:00
Simon Michael
c3b76221d4 pkg: rename terminfo flag, drop pretty-show conditionals 2016-08-09 12:16:24 -07:00
Simon Michael
9ad7f2f7e4 pkg: drop unused double flag 2016-08-09 12:04:19 -07:00
Simon Michael
cf8ebd4ae2 pkg: rename, clean up oldtime flag 2016-08-09 12:03:23 -07:00
Simon Michael
1b65582908 pkg: clean up deps slightly 2016-08-09 12:02:57 -07:00
Simon Michael
4c313be10e reorder yaml files consistently 2016-08-09 11:39:42 -07:00
Simon Michael
570de3a0a5 format package descriptions more nicely 2016-08-09 11:29:17 -07:00
Simon Michael
bc72aad6f0 lib: remove comment breaking doctests 2016-08-09 07:58:19 -07:00
Simon Michael
0302be1b15 tools: fix tested-with in package.yamls 2016-08-09 07:57:30 -07:00
Simon Michael
d165600155 lib, cli, web, api: use hpack (package.yaml) for all packages at last #371
Generated package.yaml files from the old cabal files with hpack-convert,
removed some problematic blank lines manually,
regenerated the cabal files from the package.yaml files with hpack.
Tests pass, looks like all the info is still there.

This means that from now on, we don't edit cabal files directly.
We edit the less verbose package.yaml files. stack will update
the cabal files automatically (or non-stack users can use hpack).
The changes to both are committed, as we still want to provide
the cabal files to downloaders.
2016-08-09 07:24:57 -07:00
Simon Michael
39c5eb9801 balance: make -H work with single-column reports #392
-H/--historical now makes a single-column balance report with a start
date show historical balances reflecting earlier postings.  This is
equivalent to specifying no start date, but it's more consistent.
2016-08-08 17:40:41 -07:00
Simon Michael
156922e419 lib: more history awareness for account transactions report #392
The account transactions report (and eg hledger-ui's register screen) no
longer aborts showing historical balances when -E/--empty/nonzero mode
or cur: are in effect.
2016-08-08 17:25:42 -07:00
Simon Michael
974b1e3be0 lib: simplify balance report types; haddocks 2016-08-08 17:23:21 -07:00
Simon Michael
67a76b297a hlint-clean BalanceReport, MultiBalanceReport 2016-08-08 08:31:01 -07:00
Simon Michael
b84e366f06 comment fixes 2016-08-08 07:22:17 -07:00
Simon Michael
b991103bcc BalanceHistoryReport is not used 2016-08-08 07:11:16 -07:00
Simon Michael
02845ccf3d whitespace clarifying this large module's structure, comments 2016-08-08 07:10:36 -07:00
Simon Michael
b4f3d6e1c5 hlint suggestion 2016-08-08 07:06:40 -07:00
Simon Michael
7aa23f6ca2 doc: update generated manuals, and show 0.28dev there 2016-08-08 06:49:50 -07:00
Simon Michael
009fe6d09f Revert "add: suggest only one commodity at a time as default amount #383"
Overcommitted.

This reverts commit 92b97e7bd3.
2016-08-06 19:59:18 -07:00
Simon Michael
92b97e7bd3 add: suggest only one commodity at a time as default amount #383
Since we currently can't accept more than one commodity as input.
2016-08-04 11:55:46 -07:00
Sam Doshi
7bd5422c01 fix the haddock for amounts (#382) 2016-08-03 09:29:22 -07:00
Simon Michael
2bee53af96 doc: updated generated manuals 2016-08-02 12:55:14 -07:00
Simon Michael
985ca50814 doc: expand period expressions, rename "report interval" 2016-08-02 12:51:18 -07:00
Simon Michael
06a567fe0a lib: periodGrow, periodNext, periodPrevious 2016-08-02 08:24:04 -07:00
Simon Michael
fe6d4cc7da lib: abstract period/interval/cleared in ReportOpts 2016-07-29 19:20:56 -07:00
Simon Michael
7d81adcefa lib: use Period for rendering DateSpans 2016-07-29 11:41:42 -07:00
Simon Michael
94537f30d4 lib: Period, a richer period type 2016-07-29 10:27:30 -07:00
Simon Michael
b7071dee84 lib: use Data.Default directly, not via cmdargs 2016-07-29 10:15:48 -07:00
Simon Michael
4022f5cb61 lib, web: fix some warnings after megaparsec change 2016-07-29 09:55:02 -07:00
Moritz Kiefer
4141067428 Replace Parsec with Megaparsec (see #289) (#366)
* Replace Parsec with Megaparsec (see #289)

This builds upon PR #289 by @rasendubi

* Revert renaming of parseWithState to parseWithCtx

* Fix doctests

* Update for Megaparsec 5

* Specialize parser to improve performance

* Pretty print errors

* Swap StateT and ParsecT

This is necessary to get the correct backtracking behavior, i.e. discard
state changes if the parsing fails.
2016-07-29 08:57:10 -07:00
Simon Michael
90c0d40777 lib, ui, web: more careful dates in account transactions report/registers
Clarify the account transactions report, and don't change original transactions' dates.

Show a more accurate date in hledger-ui and hledger-web's account registers
when postings have their own dates. This is now called the "transaction register date":
the date which is displayed for that transaction in a 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 dates.
2016-07-27 12:12:42 -07:00
Simon Michael
63b9f288f5 doc: csv: small rewordings 2016-07-21 19:47:34 -07:00
Simon Michael
7eeb5e01ee ui: I toggles balance assertions
This was a bit tricky.
2016-07-06 15:08:57 -07:00
Simon Michael
479a4138fe journal: better errors and debug output for balance assertions
With --debug=2, better information about assertions is printed.
Balance assertion errors now have a more standard and parseable layout.
The asserted balance is now shown with the diff, let's see if that's better.
2016-07-05 14:12:46 -07:00
Simon Michael
2d7a1904b4 dbgtrace takes a level parameter 2016-07-05 14:09:21 -07:00
Simon Michael
74d8570da3 lib: note that depth does not affect transactions reports 2016-06-12 07:40:40 -07:00
Simon Michael
68a1a8687a doc: generate really plain text manuals
Drop the nice ansi highlighting that won't work everywhere,
the unpredictable unicode hyphens, etc.
2016-06-11 21:34:20 -07:00
Simon Michael
579ab45d0a lib: clarify balance assertion error again
"calculated" is better, "actual" implies the account's actual real-world
balance which might be something else again.
2016-06-07 09:23:54 -07:00
Simon Michael
a216c7216a lib: search all .hs files for doctests 2016-06-06 19:45:59 -07:00
Simon Michael
98cbcced57 lib: account transactions report filters by realness & status
Two fixes for this report when --real/--cleared/real:/status: are in effect,
affecting hledger-ui and possibly hledger-web:

1. exclude transactions which affect the current account via an excluded posting type.
    Eg when --real is in effect, a transaction posting to the current account with only
    virtual postings will not appear in the report.

2. when showing historical balances, don't count excluded posting types in the
    starting balance. Eg with --real, the starting balance will be the sum of only the
    non-virtual prior postings.

This is complicated and there might be some ways to confuse it still, causing
wrongly included/excluded transactions or wrong historical balances/running totals
(transactions with both real and virtual postings to the current account, perhaps ?)
2016-06-03 17:51:10 -07:00
Simon Michael
54571ede20 doc: journal: describe postings & their cleared flag 2016-06-03 10:21:09 -07:00
Simon Michael
7c8d7e9820 ui: transaction: ignore real/cleared/empty, always show full txn (#354)
This commit clarifies the account transactions report: as before the included transactions
are the original unfiltered transactions, but now the change and running balance amounts
are calculated from the report-matched postings. This fixed the limitation noted in 509f558,
so that toggling real mode in any screen could work. Then I decided the transaction screen
shouldn't show a partial transaction after all, so real/cleared filtering is no longer allowed or indicated here.
2016-06-02 07:03:00 -07:00
Simon Michael
7f3ae224e2 lib: refactor journal utils 2016-06-01 20:47:27 -07:00
Simon Michael
509f55864d ui: indicate real mode and toggle it with R key (#354)
There is a limitation/bug: disabling real mode in the transaction screen
won't show the non-real postings if it was entered from a real-mode
register screen.
2016-06-01 12:30:39 -07:00
Simon Michael
788021f5a4 ui: make --real/-R affect register/txn screens (#354) 2016-06-01 10:48:57 -07:00
Simon Michael
a961988a88 bump cabal versions to 0.28 2016-05-29 00:00:59 -07:00
Simon Michael
df07ad0109 doc: parameterise and bump docs version to 0.28 2016-05-28 23:31:44 -07:00
Simon Michael
bd3212654c doc: bring embedded help files up to date 2016-05-28 12:58:30 -07:00
Simon Michael
ad3c5dfb4d lib: fix ghc 8-related date issues (#352)
Our null date is now 0000/01/01 instead of 0000/00/00.
2016-05-27 08:06:53 -07:00
Simon Michael
f3bf98bfae lib: parentheses trying to resolve IDE warning 2016-05-26 15:51:59 -07:00
Simon Michael
cdc323d05b Revert "lib: allow transformers 0.5.* (#351)"
A bump too far.
This reverts commit fa7878278a.
2016-05-26 12:23:57 -07:00
Simon Michael
fa7878278a lib: allow transformers 0.5.* (#351) 2016-05-26 11:58:47 -07:00
Simon Michael
90c9735b7a lib: textification: descriptions & codes
Slightly higher (with small files) and lower (with large files) maximum
residency, and slightly quicker for all.

hledger -f data/100x100x10.journal stats
<<ghc: 42858472 bytes, 84 GCs, 193712/269608 avg/max bytes residency (3 samples), 2M in use, 0.000 INIT (0.015 elapsed), 0.016 MUT (0.042 elapsed), 0.011 GC (0.119 elapsed) :ghc>>
<<ghc: 42891776 bytes, 84 GCs, 190816/260920 avg/max bytes residency (3 samples), 2M in use, 0.000 INIT (0.004 elapsed), 0.017 MUT (0.025 elapsed), 0.010 GC (0.015 elapsed) :ghc>>

hledger -f data/1000x1000x10.journal stats
<<ghc: 349575240 bytes, 681 GCs, 1396425/4091680 avg/max bytes residency (7 samples), 11M in use, 0.000 INIT (0.000 elapsed), 0.137 MUT (0.146 elapsed), 0.050 GC (0.057 elapsed) :ghc>>
<<ghc: 349927568 bytes, 681 GCs, 1397825/4097248 avg/max bytes residency (7 samples), 11M in use, 0.000 INIT (0.000 elapsed), 0.126 MUT (0.133 elapsed), 0.050 GC (0.057 elapsed) :ghc>>

hledger -f data/10000x1000x10.journal stats
<<ghc: 3424029496 bytes, 6658 GCs, 11403141/41077288 avg/max bytes residency (11 samples), 111M in use, 0.000 INIT (0.000 elapsed), 1.278 MUT (1.310 elapsed), 0.493 GC (0.546 elapsed) :ghc>>
<<ghc: 3427418064 bytes, 6665 GCs, 11127869/37790168 avg/max bytes residency (11 samples), 109M in use, 0.000 INIT (0.001 elapsed), 1.212 MUT (1.229 elapsed), 0.466 GC (0.519 elapsed) :ghc>>

hledger -f data/100000x1000x10.journal stats
<<ghc: 34306546248 bytes, 66727 GCs, 77030638/414617944 avg/max bytes residency (14 samples), 1012M in use, 0.000 INIT (0.000 elapsed), 12.965 MUT (13.164 elapsed), 4.771 GC (5.447 elapsed) :ghc>>
<<ghc: 34340246056 bytes, 66779 GCs, 76983178/416011480 avg/max bytes residency (14 samples), 1011M in use, 0.000 INIT (0.008 elapsed), 12.666 MUT (12.836 elapsed), 4.595 GC (5.175 elapsed) :ghc>>
2016-05-24 19:00:58 -07:00
Simon Michael
a1b68009da lib: fix tests; always try parsing stdin as journal 2016-05-24 19:00:58 -07:00
Simon Michael
770dcee742 lib: textification: comments and tags
No change.

hledger -f data/100x100x10.journal stats
<<ghc: 42859576 bytes, 84 GCs, 193781/269984 avg/max bytes residency (3 samples), 2M in use, 0.000 INIT (0.001 elapsed), 0.016 MUT (0.020 elapsed), 0.009 GC (0.011 elapsed) :ghc>>
<<ghc: 42859576 bytes, 84 GCs, 193781/269984 avg/max bytes residency (3 samples), 2M in use, 0.000 INIT (0.001 elapsed), 0.015 MUT (0.018 elapsed), 0.009 GC (0.013 elapsed) :ghc>>

hledger -f data/1000x1000x10.journal stats
<<ghc: 349576344 bytes, 681 GCs, 1407388/4091680 avg/max bytes residency (7 samples), 11M in use, 0.000 INIT (0.000 elapsed), 0.124 MUT (0.130 elapsed), 0.047 GC (0.055 elapsed) :ghc>>
<<ghc: 349576280 bytes, 681 GCs, 1407388/4091680 avg/max bytes residency (7 samples), 11M in use, 0.000 INIT (0.000 elapsed), 0.126 MUT (0.132 elapsed), 0.049 GC (0.058 elapsed) :ghc>>

hledger -f data/10000x1000x10.journal stats
<<ghc: 3424030664 bytes, 6658 GCs, 11403359/41071624 avg/max bytes residency (11 samples), 111M in use, 0.000 INIT (0.000 elapsed), 1.207 MUT (1.228 elapsed), 0.473 GC (0.528 elapsed) :ghc>>
<<ghc: 3424030760 bytes, 6658 GCs, 11403874/41077288 avg/max bytes residency (11 samples), 111M in use, 0.000 INIT (0.002 elapsed), 1.234 MUT (1.256 elapsed), 0.470 GC (0.520 elapsed) :ghc>>

hledger -f data/100000x1000x10.journal stats
<<ghc: 34306547448 bytes, 66727 GCs, 76805504/414629288 avg/max bytes residency (14 samples), 1009M in use, 0.000 INIT (0.003 elapsed), 12.615 MUT (12.813 elapsed), 4.656 GC (5.291 elapsed) :ghc>>
<<ghc: 34306547320 bytes, 66727 GCs, 76805504/414629288 avg/max bytes residency (14 samples), 1009M in use, 0.000 INIT (0.009 elapsed), 12.802 MUT (13.065 elapsed), 4.774 GC (5.441 elapsed) :ghc>>
2016-05-24 19:00:57 -07:00
Simon Michael
c89c33b36e lib: textification: parse stream
10% more allocation, but 35% lower maximum residency, and slightly quicker.

hledger -f data/100x100x10.journal stats
<<ghc: 39327768 bytes, 77 GCs, 196834/269496 avg/max bytes residency (3 samples), 2M in use, 0.000 INIT (0.010 elapsed), 0.020 MUT (0.092 elapsed), 0.014 GC (0.119 elapsed) :ghc>>
<<ghc: 42842136 bytes, 84 GCs, 194010/270912 avg/max bytes residency (3 samples), 2M in use, 0.000 INIT (0.009 elapsed), 0.016 MUT (0.029 elapsed), 0.012 GC (0.120 elapsed) :ghc>>

hledger -f data/1000x1000x10.journal stats
<<ghc: 314291440 bytes, 612 GCs, 2070776/6628048 avg/max bytes residency (7 samples), 16M in use, 0.000 INIT (0.000 elapsed), 0.128 MUT (0.144 elapsed), 0.059 GC (0.070 elapsed) :ghc>>
<<ghc: 349558872 bytes, 681 GCs, 1397597/4106384 avg/max bytes residency (7 samples), 11M in use, 0.000 INIT (0.004 elapsed), 0.124 MUT (0.133 elapsed), 0.047 GC (0.053 elapsed) :ghc>>

hledger -f data/10000x1000x10.journal stats
<<ghc: 3070026824 bytes, 5973 GCs, 12698030/62951784 avg/max bytes residency (10 samples), 124M in use, 0.000 INIT (0.002 elapsed), 1.268 MUT (1.354 elapsed), 0.514 GC (0.587 elapsed) :ghc>>
<<ghc: 3424013128 bytes, 6658 GCs, 11405501/41071624 avg/max bytes residency (11 samples), 111M in use, 0.000 INIT (0.001 elapsed), 1.343 MUT (1.406 elapsed), 0.511 GC (0.573 elapsed) :ghc>>

hledger -f data/100000x1000x10.journal stats
<<ghc: 30753387392 bytes, 59811 GCs, 117615462/666703600 avg/max bytes residency (14 samples), 1588M in use, 0.000 INIT (0.000 elapsed), 12.068 MUT (12.238 elapsed), 6.015 GC (7.190 elapsed) :ghc>>
<<ghc: 34306530696 bytes, 66727 GCs, 76806196/414629312 avg/max bytes residency (14 samples), 1009M in use, 0.000 INIT (0.010 elapsed), 14.357 MUT (16.370 elapsed), 5.298 GC (6.534 elapsed) :ghc>>
2016-05-24 19:00:57 -07:00
Simon Michael
58c3362908 lib: textification: saved journal source
Slightly worse on small files, better on large ones.

hledger -f data/100x100x10.journal stats
<<ghc: 39305392 bytes, 77 GCs, 196354/268584 avg/max bytes residency (3 samples), 2M in use, 0.000 INIT (0.007 elapsed), 0.014 MUT (0.027 elapsed), 0.011 GC (0.111 elapsed) :ghc>>
<<ghc: 39307728 bytes, 77 GCs, 196909/270248 avg/max bytes residency (3 samples), 2M in use, 0.001 INIT (0.010 elapsed), 0.015 MUT (0.028 elapsed), 0.012 GC (0.116 elapsed) :ghc>>

hledger -f data/1000x1000x10.journal stats
<<ghc: 314285912 bytes, 612 GCs, 2064811/6597608 avg/max bytes residency (7 samples), 16M in use, 0.000 INIT (0.002 elapsed), 0.126 MUT (0.134 elapsed), 0.059 GC (0.069 elapsed) :ghc>>
<<ghc: 314271368 bytes, 612 GCs, 2070227/6628024 avg/max bytes residency (7 samples), 16M in use, 0.000 INIT (0.000 elapsed), 0.137 MUT (0.143 elapsed), 0.059 GC (0.068 elapsed) :ghc>>

hledger -f data/10000x1000x10.journal stats
<<ghc: 3070033264 bytes, 5965 GCs, 12699294/62962464 avg/max bytes residency (10 samples), 124M in use, 0.000 INIT (0.000 elapsed), 1.245 MUT (1.300 elapsed), 0.498 GC (0.558 elapsed) :ghc>>
<<ghc: 3070006752 bytes, 5973 GCs, 12687314/62848920 avg/max bytes residency (10 samples), 124M in use, 0.000 INIT (0.003 elapsed), 1.257 MUT (1.281 elapsed), 0.496 GC (0.554 elapsed) :ghc>>

hledger -f data/100000x1000x10.journal stats
<<ghc: 30753465088 bytes, 59763 GCs, 117723618/666643528 avg/max bytes residency (14 samples), 1589M in use, 0.000 INIT (0.002 elapsed), 12.536 MUT (12.793 elapsed), 5.978 GC (7.155 elapsed) :ghc>>
<<ghc: 30753367256 bytes, 59811 GCs, 117723236/666627528 avg/max bytes residency (14 samples), 1590M in use, 0.001 INIT (0.012 elapsed), 12.923 MUT (13.169 elapsed), 5.981 GC (6.860 elapsed) :ghc>>
2016-05-24 19:00:57 -07:00
Simon Michael
102b76c17f lib: textification: commodity symbols
hledger -f data/100x100x10.journal stats
<<ghc: 39288536 bytes, 77 GCs, 196608/269560 avg/max bytes residency (3 samples), 2M in use, 0.000 INIT (0.001 elapsed), 0.016 MUT (0.028 elapsed), 0.009 GC (0.012 elapsed) :ghc>>
<<ghc: 39290808 bytes, 77 GCs, 196608/269560 avg/max bytes residency (3 samples), 2M in use, 0.000 INIT (0.003 elapsed), 0.015 MUT (0.021 elapsed), 0.009 GC (0.011 elapsed) :ghc>>

hledger -f data/1000x100x10.journal stats
<<ghc: 314268960 bytes, 612 GCs, 2143219/6826152 avg/max bytes residency (7 samples), 16M in use, 0.000 INIT (0.009 elapsed), 0.135 MUT (0.151 elapsed), 0.065 GC (0.178 elapsed) :ghc>>
<<ghc: 314254512 bytes, 612 GCs, 2072377/6628024 avg/max bytes residency (7 samples), 16M in use, 0.000 INIT (0.000 elapsed), 0.130 MUT (0.134 elapsed), 0.064 GC (0.075 elapsed) :ghc>>

hledger -f data/10000x100x10.journal stats
<<ghc: 3070016592 bytes, 5965 GCs, 13138220/64266016 avg/max bytes residency (10 samples), 128M in use, 0.000 INIT (0.000 elapsed), 1.272 MUT (1.322 elapsed), 0.527 GC (0.595 elapsed) :ghc>>
<<ghc: 3069989896 bytes, 5973 GCs, 12687877/62848920 avg/max bytes residency (10 samples), 124M in use, 0.000 INIT (0.002 elapsed), 1.295 MUT (1.324 elapsed), 0.511 GC (0.570 elapsed) :ghc>>

hledger -f data/100000x100x10.journal stats
<<ghc: 30753448072 bytes, 59763 GCs, 121502982/673169248 avg/max bytes residency (14 samples), 1640M in use, 0.000 INIT (0.007 elapsed), 12.421 MUT (12.672 elapsed), 6.240 GC (7.812 elapsed) :ghc>>
<<ghc: 30753350528 bytes, 59811 GCs, 117616668/666703600 avg/max bytes residency (14 samples), 1588M in use, 0.001 INIT (0.011 elapsed), 13.209 MUT (13.683 elapsed), 6.137 GC (7.117 elapsed) :ghc>>
2016-05-24 19:00:57 -07:00
Simon Michael
2538d14ea7 lib: textification begins! account names
The first of several conversions from String to (strict) Text, hopefully
reducing space and time usage.

This one shows a small improvement, with GHC 7.10.3 and text-1.2.2.1:

hledger -f data/100x100x10.journal stats
string: <<ghc: 39471064 bytes, 77 GCs, 198421/275048 avg/max bytes residency (3 samples), 2M in use, 0.000 INIT (0.001 elapsed), 0.015 MUT (0.020 elapsed), 0.010 GC (0.014 elapsed) :ghc>>
text:   <<ghc: 39268024 bytes, 77 GCs, 197018/270840 avg/max bytes residency (3 samples), 2M in use, 0.000 INIT (0.002 elapsed), 0.016 MUT (0.022 elapsed), 0.009 GC (0.011 elapsed) :ghc>>

hledger -f data/1000x100x10.journal stats
string: <<ghc: 318555920 bytes, 617 GCs, 2178997/7134472 avg/max bytes residency (7 samples), 16M in use, 0.000 INIT (0.001 elapsed), 0.129 MUT (0.136 elapsed), 0.067 GC (0.077 elapsed) :ghc>>
text:   <<ghc: 314248496 bytes, 612 GCs, 2074045/6617960 avg/max bytes residency (7 samples), 16M in use, 0.000 INIT (0.003 elapsed), 0.137 MUT (0.145 elapsed), 0.067 GC (0.079 elapsed) :ghc>>

hledger -f data/10000x100x10.journal stats
string: <<ghc: 3114763608 bytes, 6026 GCs, 18858950/75552024 avg/max bytes residency (11 samples), 201M in use, 0.000 INIT (0.000 elapsed), 1.331 MUT (1.372 elapsed), 0.699 GC (0.812 elapsed) :ghc>>
text:   <<ghc: 3071468920 bytes, 5968 GCs, 14120344/62951360 avg/max bytes residency (9 samples), 124M in use, 0.000 INIT (0.003 elapsed), 1.272 MUT (1.349 elapsed), 0.513 GC (0.578 elapsed) :ghc>>

hledger -f data/100000x100x10.journal stats
string: <<ghc: 31186579432 bytes, 60278 GCs, 135332581/740228992 avg/max bytes residency (13 samples), 1697M in use, 0.000 INIT (0.008 elapsed), 14.677 MUT (15.508 elapsed), 7.081 GC (8.074 elapsed) :ghc>>
text:   <<ghc: 30753427672 bytes, 59763 GCs, 117595958/666457240 avg/max bytes residency (14 samples), 1588M in use, 0.000 INIT (0.008 elapsed), 13.713 MUT (13.966 elapsed), 6.220 GC (7.108 elapsed) :ghc>>
2016-05-24 19:00:49 -07:00
Simon Michael
097c9e09b6 lib: cleanups 2016-05-23 12:51:15 -07:00
Simon Michael
0f5ee154c4 lib: simplify parsers; cleanups (#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 removes any possibility of
the journal updates being a space leak. (They weren't, in fact memory
usage is now slightly higher, but that will be addressed in other ways.)

Also:

Journal data and journal parse info have been merged into one type (for
now), and field names are more consistent.

The ParsedJournal type alias has been added to distinguish being-parsed
and finalised journals.

Journal is now a monoid.

stats: fixed an issue with ordering of include files

journal: fixed an issue with ordering of included same-date transactions

timeclock: sessions can no longer span file boundaries (unclocked-out
sessions will be auto-closed at the end of the file).

expandPath now throws a proper IO error (and requires the IO monad).
2016-05-23 00:44:19 -07:00