Commit Graph

1583 Commits

Author SHA1 Message Date
Peter Simons
027d084878 Drop undecidable Ord instance for ParseError.
That code fails to compile with ghc-8.6.1 because the instance is undecidable.
I suppose we could enable the appropriate compiler extension to support it, but
I've found that simply removing the instance causes no problems whatsoever: the
entire repository still compiles fine and it passes all test suites, too.
2018-10-24 10:35:11 -07:00
Peter Simons
4e8f2c11d3 Allow building with base-4.12.
The build succeeds just fine and all test suites pass, too.
2018-10-24 10:35:11 -07:00
Mykola Orliuk
1aac38d3d3 lib: include source info in txn balance errors
Partially address simonmichael/hledger#904
2018-10-23 15:54:38 -07:00
Simon Michael
3f6922b51f lib: showTransaction: comment
[ci skip]
2018-10-22 14:28:18 -07:00
Samuel May
e57ef9e9a9 lib: journal: Add support for exact assertions 2018-10-22 09:55:14 -07:00
Samuel May
6c31393dd3 lib: Groundwork allowing multi-commodity assertions 2018-10-22 09:55:14 -07:00
Samuel May
cde91fc5f4 lib: Make BalanceAssertion a full datatype
Note: simplifies/moves whitespace parsing out of the balance assertion
parser.
2018-10-22 09:55:14 -07:00
Simon Michael
0d531bb24f lib: showTransaction: fix a case showing multiple missing amounts
Noticed by peti: showTransaction could sometimes hide the last posting's
amount even if one of the other posting amounts was already implcit,
producing invalid transaction output.
2018-10-22 07:23:40 -07:00
Simon Michael
b5a90432ff lib: document and test showTransaction*, posting*AsLines 2018-10-22 06:46:31 -07:00
Simon Michael
20f006f7f6 lib: transaction: drop commented code 2018-10-22 04:03:29 -07:00
Simon Michael
80dc2ef03f update cabal files with hpack 0.31
As in latest stack release. Hopefully this won't unleash horrors.
2018-10-18 14:44:16 -07:00
Simon Michael
b5df5fb5f0 lib: comment 2018-10-18 14:43:00 -07:00
Simon Michael
74611a7be1 ui: accounts: fix balances when there's only periodic txns
And clarify multiBalanceReport.
2018-10-18 14:43:00 -07:00
Simon Michael
2c2d10f9c2 lib: plog, plogAt: add missing newline, note issue 2018-10-18 14:43:00 -07:00
Jesse Rosenthal
a6a73e36e3 Finish removing journalFinalise (#903)
* journal: Get rid of `journalFinalise` and use granular functions

Complete the process started in 53b3e2bd. This gets rid of the
`journalFinalise` function and uses the smaller steps, in order to
have more granular control.

* journal: Change order of operations in finalization

We want to make sure that we add the filepath after the order is
reversed, so the added filepath is on the head and not the tail (as it
would be if it were reversed after it was added).

* journal: Refine granular finalization functions

This commit fixes two of the granular finalization functions:

1. Rename `journalSetTime` to `journalSetLastReadTime` and improve
   documentation.

2. Remove `journalSetFilePath`. It's redundant with `journalAddFile`
   currently in `Hledger.Read.Common`. The only difference between the
   functions is where the file is added (we keep the one in which it
   is added to the tail), so we change the position vis-a-vis
   reversal.
2018-10-16 08:51:51 -07:00
Simon Michael
0f2a31bea7 docs: journal: account: a little bit more about sorting
[ci skip]
2018-10-15 12:07:44 -07:00
Simon Michael
4a399e50cb acc: don't require an explicit --flat to make --drop work 2018-10-13 13:22:11 -07:00
Simon Michael
b72f9697a2 lib: journal: account: allow whitespace or a comment after the account name 2018-10-13 13:09:49 -07:00
Simon Michael
4f2d9dde4c docs: journal: clarify transaction modifiers
[ci skip]
2018-10-12 09:12:06 -07:00
Jesse Rosenthal
53b3e2bd94 journal: split up the parts of journalFinalise, and use them as needed.
`journalFinalise` is only used in the `parseAndFinaliseJournal`
functions, but it needs to be run differently at different stages when
transaction modifiers are applied. This change breaks it into smaller
functions, and uses those smaller parts in `parseAndFinaliseJournal`
as needed.
2018-10-12 07:39:53 -07:00
Jesse Rosenthal
20f134c96b read: only run finalise twice if there are modifiers
Previously we ran if `--auto` was set. But this adds a small
performance hit if `--auto` becomes default. Now we only run twice if
there are transactionModifiers AND `--auto` is set. So even if auto is
specified, there will be no penalty if there are no modifiers.
2018-10-12 07:39:53 -07:00
Jesse Rosenthal
5a3462ce48 read: Integrate transaction modifiers with journal finalization
Currently, automated transactions are added before the journal is
finalized. This means that no inferred values will be picked up. We
change the procedure, if `auto_` is set, to

 1. first run `journalFinalise` without assertion checking (assertions
    might be wrong until automated transactions), but with reordering
 2. Insert transaction modifiers
 3. Run `journalFinalise` again, this time with assertion checking as
    set in the options, and without reordering.

If `auto_` is not set, all works as before.

Closes: #893
2018-10-12 07:39:53 -07:00
Jesse Rosenthal
b346d7f701 Journal: make reordering optional in journalFinalise
Currently `journalFinalise` always reverses the order of
entries. However, if there are automated transactions, we might need
to run it twice. This adds a boolean flag to make reordering
optional. This will be used in the `parseAndFinaliseJournal`
functions.
2018-10-12 07:39:53 -07:00
Simon Michael
51bf8cbccc docs: journal: account: a gotcha when changing builtin account types
[ci skip]
2018-10-11 16:16:33 -07:00
Simon Michael
a899f7924f docs: journal: account: update directives intro
[ci skip]
2018-10-11 15:53:06 -07:00
Simon Michael
e4215c094e doc: journal: document setting account types
[ci skip]
2018-10-09 14:24:59 -10:00
Simon Michael
605a082d77 bs/bse/cf/is: use account type declarations if any
These commands now detect the account types declared by account directives.
Whenever such declarations are not present, built-in regular expressions
are used, as before.
2018-10-09 14:24:59 -10:00
Simon Michael
c1236fa6e9 journal: account directives can declare account types
Previously you had to use one of the standard english account names
(assets, liabilities..) for top-level accounts, if you wanted to use
the bs/bse/cf/is commands.
Now, account directives can specify which of the big five categories
an account belongs to - asset, liability, equity, revenue or expense -
by writing one of the letters A, L, E, R or X two or more spaces after
the account name (where the numeric account code used to be).

This might change. Some thoughts influencing the current syntax:
- easy to type and read
- does not require multiple lines
- does not depend on any particular account numbering scheme
- allows more types later if needed
- still anglocentric, but only a little
- could be treated as syntactic sugar for account tags later
- seems to be compatible with (ignored by) current Ledger

The current design permits unlimited account type declarations anywhere
in the account tree. So you could declare a liability account somewhere
under assets, and maybe a revenue account under that, and another asset
account even further down. In such cases you start to see oddities like
accounts appearing in multiple places in a tree-mode report. In theory
the reports will still behave reasonably, but this has not been tested
too hard. In any case this is clearly too much freedom. I have left it
this way, for now, in case it helps with:

- modelling contra accounts ?
- multiple files. I suspect the extra expressiveness may come in handy
  when combining multiple files with account type declarations,
  rewriting account names, apply parent accounts etc.
  If we only allowed type declarations on top-level accounts, or
  only allowed a single account of each type, complications seem likely.
2018-10-09 14:24:59 -10:00
Mykola Orliuk
8c6a418325 lib: fix home path expansion in includes
fixes simonmichael/hledger#896
2018-10-09 13:35:40 -10:00
Simon Michael
6c57629b8c lib: fix posting-date-and-balance-assignment error properly (#894) 2018-10-09 16:08:47 -07:00
Simon Michael
8c7c59017a lib: fix my wrong merge of #880 more 2018-10-09 15:26:15 -07:00
Simon Michael
36fdeceb6c lib: tweak posting-date-no-amount-balance-assertion error (#894) 2018-10-09 14:15:52 -07:00
Simon Michael
f6e095e794 lib: fix my wrong merge of #880 2018-10-09 14:06:22 -07:00
Simon Michael
88887e5458
Merge branch 'master' into ExceptTLayer 2018-10-09 10:31:32 -10:00
Simon Michael
278802e648 journal: Y affects dates in periodic transactions (fix #892) 2018-10-09 11:54:40 -07:00
Simon Michael
ab26220b23 lib: document SmartDate
[ci skip]
2018-10-09 10:43:03 -07:00
Alex Chen
2cbc41e088 Merge branch 'master' into ExceptTLayer 2018-10-09 11:19:45 -06:00
Alex Chen
e45070aab5 Update dependency bounds for megaparsec 2018-10-09 11:15:33 -06:00
Alex Chen
a8d642d5b5 lib: revise comments for "final" parse errors
- also simplify their implementation a bit
2018-10-09 11:05:46 -06:00
Simon Michael
862fb873b4 update embedded manuals 2018-10-06 09:42:27 -10:00
Simon Michael
ff2a546319 bump version to 1.11.99 2018-10-06 09:42:12 -10:00
Simon Michael
e687ef1a79 doc: changelogs, relnotes 2018-10-06 09:40:06 -10:00
Simon Michael
2ba135e402 lib: journal: fix wrong txn rendering in balance assertion errors 2018-10-06 09:31:22 -10:00
Simon Michael
190eee5485 lib: comment
[ci skip]
2018-10-05 11:05:39 -10:00
Simon Michael
2c9c4ebf79
Merge branch 'master' into ExceptTLayer 2018-10-04 21:04:02 -10:00
Simon Michael
7bc500ccd2 update embedded manuals 2018-09-30 20:08:15 -10:00
Simon Michael
b798c48040 bump version to 1.11 2018-09-30 20:07:45 -10:00
Simon Michael
92c8a6fffb changelogs 2018-09-30 20:05:26 -10:00
Alex Chen
3d2584d869 lib: switch to megaparsec 7 2018-09-30 20:15:12 -06:00
Alex Chen
26369c28a3 lib: remove old code for include file parse errors 2018-09-29 22:55:10 -06:00