Commit Graph

839 Commits

Author SHA1 Message Date
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
Simon Michael
4179a83c1d lib: pprint 2016-05-20 08:31:39 -07:00
Simon Michael
550e99acd3 lib: let dbg*IO work in any MonadIO 2016-05-20 07:51:51 -07:00
Simon Michael
7f5e09096f lib: rename JournalContext to JournalParseState 2016-05-18 20:57:34 -07:00
Simon Michael
ea383d88d6 lib: drop "double" build flag 2016-05-18 20:32:58 -07:00
Simon Michael
ff09d60746 lib: types whitespace 2016-05-18 20:28:37 -07:00
Simon Michael
ae490d738f lib: Hledger.Read notes 2016-05-18 16:42:25 -07:00
Simon Michael
20bfceff2e lib: allow multiple files of different format (#320)
When multiple files are specified with multiple -f options, we now
parse each one individually, rather than just concatenating them, so
they can have different formats.

Directives (like default year or account aliases) no longer carry over
from one file to the next. Limitation or feature ?
2016-05-18 16:41:52 -07:00
Simon Michael
fdd7feefdb lib: make Journal a monoid 2016-05-18 15:08:50 -07:00
Simon Michael
6ed0369cdc lib: note transaction idx only counts journal txns 2016-05-18 15:06:57 -07:00
Simon Michael
7e84b4d643 lib: rename get/setIndex, add increment fn 2016-05-18 15:06:16 -07:00
Simon Michael
84097b75c7 journal: can now include timeclock/timedot files (#320)
journal files can now include journal, timeclock or timedot files (but
not yet CSV files). Also timeclock/timedot files no longer support
default year directives.

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 have moved to
Hledger.Read.
2016-05-17 19:46:54 -07:00
Simon Michael
ec507955e1 journal: simplify parse error 2016-05-17 10:06:51 -07:00
Simon Michael
89b1cd1e5b doc: readme for doc directories 2016-05-17 10:03:57 -07:00
Simon Michael
9c130e1850 lib: journal: hlint cleanups!
Hopefully still backward compatible.
2016-05-13 22:09:39 -07:00
Simon Michael
16ee07cc52 remove temp type 2016-05-13 20:44:21 -07:00
Simon Michael
9197c0545f doc: journal: improve amount, virtual posting docs 2016-05-10 07:58:38 -07:00
Simon Michael
7a616d6779 doc: journal: commodity directive, amount formats (#295) 2016-05-08 21:10:58 -07:00
Simon Michael
ddefec412f journal: also allow one-line commodity directives 2016-05-08 20:56:34 -07:00
Simon Michael
b583cb327d lib: fix a warning 2016-05-08 20:55:59 -07:00
Simon Michael
9304aa1100 journal: commodity format directive overrides inferred 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 doesn't fix the root cause of #295 but is at least a
good workaround.
2016-05-08 09:07:08 -07:00
Simon Michael
2c0ef877eb journal: parse and store commodity formats 2016-05-08 09:06:54 -07:00
Simon Michael
207922a023 lib: Commodity now has a CommoditySymbol and style 2016-05-08 08:07:27 -07:00
Simon Michael
aac67b3d4d lib: fix parsedate haddock 2016-05-06 19:02:48 -07:00
Simon Michael
ce344f9b96 lib: fix a haddock error 2016-05-06 18:16:12 -07:00
Simon Michael
e9c6c1ef5e lib: convert date hunit tests to doctests 2016-05-06 18:10:49 -07:00
Simon Michael
c9a892eabe lib: remove hopefully superfluous comment 2016-05-06 17:40:33 -07:00
Simon Michael
a52fd599c4 lib: more compact Show instance for datespans 2016-05-06 17:23:24 -07:00
Simon Michael
884c0b8a58 reg: fix sorting regression with --date2 (#326)
And rewrite/clarify postingsReport.
2016-05-06 17:19:43 -07:00
Simon Michael
6cbc0ceb0d lib: note issues 2016-05-06 17:19:23 -07:00
Simon Michael
e7a1eb627f journal: export parsing helpers, fix warning 2016-05-06 16:58:07 -07:00
Simon Michael
e2ce7c4802 doc, tests: clarify what --date2 does 2016-05-06 16:57:24 -07:00
Simon Michael
525ca6041d lib: tweak balance assertion message 2016-05-04 09:08:53 -07:00
Simon Michael
9a424d77fc lib: more thorough journal reloading
Reloading a journal should now reload all included files as well.
2016-05-02 20:07:53 -07:00
Simon Michael
7ec3ebb66b update tested-with
Note we seem to have lost GHC 7.4 compatibility. It should be fixable if
anyone cares.
2016-04-28 17:32:17 -07:00
Simon Michael
856c0b3042 lib: fix bracketed posting dates, parser cleanup (#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. Also the journal parser types generally have been
tightened up and clarified, making it much easier to know how to combine
and run them. There's now

-- | A parser of strings with generic user state, monad and return type.
type StringParser u m a = ParsecT String u m a

-- | A string parser with journal-parsing state.
type JournalParser m a = StringParser JournalContext m a

-- | A journal parser that runs in IO and can throw an error mid-parse.
type ErroringJournalParser a = JournalParser (ExceptT String IO) a

and corresponding convenience functions (and short aliases) for running them.
2016-04-28 13:34:57 -07:00
Simon Michael
259e7bfbe3 lib: add a doctest suite 2016-04-28 13:34:57 -07:00
Simon Michael
9946e7df88 lib: organise JournalReader a bit 2016-04-28 13:34:57 -07:00
Simon Michael
50aeb90596 lib, ui: GHC 8 compatibility 2016-04-28 12:55:19 -07:00
Simon Michael
91847fc6fd data-files does not support wildcards after all 2016-04-20 13:23:05 -07:00
Simon Michael
33b5c5dc94 declare generated docs as data-files, sync hpack yamls 2016-04-20 12:47:17 -07:00
Simon Michael
80948d1db7 doc: also commit info files, should fix travis 2016-04-20 12:47:17 -07:00
Simon Michael
3d129f6d31 shake: also generate info manuals 2016-04-18 17:54:55 -07:00
Simon Michael
df4b82740b lib: make the supported format names accessible 2016-04-18 16:43:57 -07:00
Simon Michael
82f35dddd0 doc: m4 macro for web table of contents 2016-04-16 11:00:39 -07:00
Simon Michael
4c291dc54e doc: use macros not divs to select web/man content
Use slightly clearer m4 macros instead of special divs to mark content
as web only/man only. The temporary doc/*.md files are no longer needed,
slightly more redundant work is done.
2016-04-16 10:09:51 -07:00
Simon Michael
130d259cb1 site: show version links on manuals 2016-04-16 04:44:33 -07:00
Simon Michael
6a97a246dd doc: use m4 for all manuals, shake cleanup 2016-04-16 03:50:30 -07:00