Commit Graph

3330 Commits

Author SHA1 Message Date
Simon Michael
0a501941ee dev: lib: ReportTypes: hlint fix 2022-09-14 16:57:54 -10:00
Simon Michael
5c14ed2ec9 dev: lib: clarify dlogAt's doc 2022-09-10 12:44:21 -10:00
Simon Michael
bc810063a5 dev: lib: improve ReportSpec doc 2022-09-07 09:53:11 -10:00
Simon Michael
427005037e cabal: update cabal files 2022-09-01 18:37:57 -07:00
Simon Michael
e5bb4f0b66 ;pkg: bump version to 1.27.99 2022-09-01 18:37:40 -07:00
Simon Michael
38ce19847b doc: update changelogs 2022-09-01 18:36:39 -07:00
Simon Michael
7631d0efa0 ;doc: update manuals 2022-09-01 18:36:34 -07:00
Simon Michael
651d584bb0 ;doc: update changelogs 2022-09-01 15:48:46 -07:00
Simon Michael
6d45630014 dev: lib: fix recently broken doctest 2022-08-29 11:15:35 +01:00
Simon Michael
79792b3368 cabal: update cabal files 2022-08-29 11:15:35 +01:00
Simon Michael
ab01c7c2a2 lib: re-enable doctests with ghc 8.10, to improve CI test 2022-08-29 11:09:16 +01:00
Simon Michael
b46cb8a7f7 cabal: update cabal files 2022-08-23 12:16:25 +01:00
Simon Michael
bfb632dd8e dev: lib: Hledger.Data.Amount: drop amount, use nullamt always 2022-08-23 12:16:15 +01:00
Simon Michael
c80c72d7cd dev: lib, cli, bin: enable/fix name shadowing warnings
And a few other cleanups.
2022-08-23 12:16:15 +01:00
Simon Michael
e5578e5c4e ;cabal: update cabal files 2022-08-23 02:02:19 +01:00
Simon Michael
9584ebb439 imp: lib: Hledger.Utils.Debug: re-export Debug.Breakpoint
And add breakpoint as a dependency and enable its GHC plugin in all
the hledger packages, so that breakpoint's helpers can be used easily.
2022-08-23 02:02:19 +01:00
Simon Michael
6a4680d561 imp: pkg: drop support for GHC 8.6 and 8.8
Slightly motivated by a desire to depend on the new breakpoint
library, which requires GHC 8.10+. With GHC 9.0 in Debian,
it seems time to drop these.
2022-08-23 02:02:19 +01:00
Simon Michael
b7b09f991a imp: lib: Hledger.Utils.Debug: fix debug logging to file
dlog has been replaced by more reliable functions for debug-logging
to a file, useful for debugging TUI apps like hledger-ui:
dlogTrace
dlogTraceAt
dlogAt
dlog0
dlog1
dlog2
dlog3
dlog4
dlog5
dlog6
dlog7
dlog8
dlog9

Monochrome pprint' and pshow' have been added.

New dependency: deepseq
2022-08-23 00:50:51 +01:00
Simon Michael
423f3bd155 ;doc: update manuals 2022-08-22 07:59:02 +01:00
Stephen Morgan
c966a0f413 fix!: cbr: Remove old account type query code. (#1921)
This replaces the old journal*AccountQuery with the new Type query. This
enables uniform treatment of account type, and fixes a subtle bug
(#1921).

Note that cbcsubreportquery no longer takes Journal as an argument.
2022-08-21 08:27:51 +01:00
Simon Michael
b32b130045 dev: lib: fix a failing doctest 2022-08-18 05:08:10 +01:00
Simon Michael
101e2f7426 imp: add a missing space after colon in some debug output 2022-08-16 09:13:30 +01:00
Simon Michael
3003a18c94 dev: lib: hlint improvements 2022-08-16 09:13:30 +01:00
Simon Michael
a3096d0549 dev: journalFilePath, include: show (unknown) instead of nothing
Probably not user-visible, but might improve debug logging slightly.
2022-08-16 09:13:30 +01:00
Simon Michael
1f08a8a94e fix: fix multi-file account display order; improve file read logging (#1909) 2022-08-16 09:13:30 +01:00
Simon Michael
07e3dca735 imp: at --debug 5, log account declarations info while parsing (#1909) 2022-08-16 09:13:30 +01:00
Simon Michael
3d6e363461 lib: save account directive positions, for troubleshooting (#1909) 2022-08-16 09:13:30 +01:00
Simon Michael
b46aa1330f fix: don't reverse account display order with include files (#1909) 2022-08-05 13:44:56 +01:00
Simon Michael
09d66c5fc1 fix: account display order is now tracked across all files (fix #1909) 2022-08-04 19:05:52 +01:00
Simon Michael
7063eba13c fix: bal: budget goal amounts now respect -c styles (fixes #1907) 2022-08-03 17:43:04 +01:00
Simon Michael
229fe6ac58 fix: areg, ui: show transactions normally with a type: query (#1905)
accountTransactionsReport was not account types-aware.
There might be more of these lurking.
2022-08-03 10:38:42 +01:00
Simon Michael
910b37abf8 fix: check: recentassertions: drop the cleared requirement (#1899)
It was causing trouble and complicating things too much.
I wanted it as another signal of being "caught up", but YAGNI.
2022-08-03 09:53:55 +01:00
Simon Michael
1ed8c20978 feat: check recentassertions disallows assertion lag > 7 days
hledger check recentassertions (or flycheck-hledger if you enable this
check) will complain if any balance-asserted account does not have a
balance assertion within 7 days before its latest posting.  This aims
to prevent the situation where you are regularly updating your
journal, but forgetting to check your balances against the real world,
eventually requiring you to dig back through months of data to find
the error.
2022-08-01 06:53:04 +01:00
Simon Michael
217cfbd389 imp: errors: assertions: improve sample hledger command 2022-07-31 08:26:30 +01:00
Simon Michael
442ef9361c feat: api: quoteForCommandLine: some very shady CLI escaping 2022-07-31 08:26:30 +01:00
Simon Michael
d860d6d2fc api: Hledger.Data.Errors: export makeBalanceAssertionErrorExcerpt 2022-07-29 09:01:34 +01:00
Simon Michael
f135001b87 ;dev: improve followingcommentp' doc 2022-07-28 09:14:13 +01:00
Simon Michael
47ae346b21 imp: errors: assertions: improve wording, actual -> calculated 2022-07-23 02:35:52 +01:00
Simon Michael
147856e3bb imp: errors: timeclock, csv error improvements 2022-07-23 02:35:52 +01:00
Stephen Morgan
c54fb4d514 imp: cost: Allow matching equity conversion equity postings to
transaction prices.

When given --infer-costs, hledger will now separately infer transaction
prices for different prices. Given a pair of adjacent conversion
postings, hledger will check if there is a single posting with a
transaction price which matches both the amounts. If so, it associates
those conversion postings to that priced post.

If it can't find any transaction price postings which match, it will
find the first non-transaction price post which matches one of the two
amounts, and will add a transaction price to that, and associate them.
2022-07-15 12:32:38 +01:00
Stephen Morgan
07d1b01287 imp: cost: Allow inferring cost from conversion equity postings with --infer-costs.
When given --infer-equity, hledger will change transaction prices to balancing equity postings. This introduces the inverse operation, --infer-costs, which will match balancing equity postings and transform them into a transaction price, allowing --cost to work properly with them. This is only a partial inverse as it needs to use some heuristics to match the postings which will not work in complicated cases.

Specifically, when hledger finds exactly two conversion postings in a transaction (by default, subaccounts of equity:conversion or equity:trad(e|ing)), it will find the first posting in the transaction whose amount is negative one of the conversion posting amounts, and inserts the corresponding transaction price.
2022-07-15 12:32:38 +01:00
Simon Michael
78d5939c19 dev: errors: improve timeclock errors 2022-07-14 19:24:46 +01:00
Simon Michael
32c7f6300b imp: errors: improve, test timeclock errors 2022-07-14 11:57:32 +01:00
Simon Michael
0ecc1ed79b dev: Uniqueleafnames.hs: fix haddock failure 2022-07-13 19:10:28 +01:00
Simon Michael
7d8fbe2dc0 dev: errors: update doctests 2022-07-13 19:00:00 +01:00
Simon Michael
5a343bf090 imp: errors: assertions: improve layout 2022-07-13 17:56:17 +01:00
Simon Michael
e172e5dd56 imp: errors: uniqueleafnames: more precise error message 2022-07-13 04:02:14 +01:00
Simon Michael
1c67d0860e imp: errors: more error prettification 2022-07-13 03:59:44 +01:00
Simon Michael
84f951e020 imp: errors: assertions, balanced: more consistent format
Move the unique text out of the first line and down to the
explanation.

Also, begin some general punctuation, capitalisation and wording
improvements.
2022-07-12 16:53:08 +01:00
Simon Michael
e6959743f5 fix: errors: assertions: don't show actual and asserted reversed 2022-07-12 16:35:45 +01:00
Simon Michael
41234f0e10 fix: errors: assertions: fix excerpt highlighting 2022-07-12 16:02:46 +01:00
Simon Michael
d07bf4afbb fix: errors: omit wrong column numbers in a number of error messages
accounts, commodities, payees, ordereddates, uniqueleafnames

The column numbers were accurate for the rendered excerpt but not
for the actual data.
2022-07-12 16:02:46 +01:00
Simon Michael
77f29aeee9 imp: errors: balancednoautoconversion: now different from balanced 2022-07-12 16:02:37 +01:00
Simon Michael
c885746aa8 imp: errors: balanced: show multicommodity amounts in one line format 2022-07-12 16:02:18 +01:00
Simon Michael
6fbcbf7c6b doc: update manuals 2022-07-12 16:01:33 +01:00
Simon Michael
7068517f2c fix: bal: budget goals were ignoring rule-specified start date 2022-07-12 10:46:29 +01:00
Simon Michael
d7f30d4fdf ;cabal: update cabal files 2022-07-11 11:18:24 +01:00
Simon Michael
d9c6406d2d doc: changelogs: updates 2022-07-11 11:02:18 +01:00
Simon Michael
7be94cf500 doc: changelogs: sync from release branch 2022-07-11 11:00:16 +01:00
Simon Michael
797cac4fc6 pkg: require safe 0.3.19+ to avoid deprecation warning 2022-07-11 06:03:14 +01:00
Simon Michael
1da7d4b7f7 imp: balanced, balancednoautoconversion: use new error format (#1436) 2022-07-10 12:12:03 +01:00
Simon Michael
b7e6583a72 imp: balance assertions now use new error format (#1436) 2022-07-10 11:39:41 +01:00
Simon Michael
42bcbad2fd imp: bal: budget goals now respect -H (#1879) 2022-07-09 09:59:17 +01:00
Stephen Morgan
3e60e784f3 fix: bal: Allow cumulative gain and valuechange reports
Previously, --cumulative with --gain or --valuechange would produce an
empty report. This fixes this issue to produce a reasonable report.
2022-07-08 16:34:23 +01:00
Simon Michael
dd14f9c822 imp: lib: Hledger.Utils.Parse: export HledgerParseErrors 2022-06-29 09:58:56 +01:00
Simon Michael
0c6cd819f2 ;doc: changelogs cleanup 2022-06-05 00:59:36 +01:00
Simon Michael
6017e5f237 ;doc: update changelogs 2022-06-05 00:56:10 +01:00
Simon Michael
f2db4c3840 ;cabal: update cabal files 2022-06-05 00:32:18 +01:00
Simon Michael
3e728b1d36 ;pkg: bump version to 1.26.99 2022-06-05 00:32:18 +01:00
Simon Michael
d8cce23b3f ;doc: changelogs: link 1.26 issues 2022-06-05 00:03:22 +01:00
Simon Michael
729a8b81e0 ;doc: update changelogs 2022-06-05 00:03:10 +01:00
Simon Michael
9833482c06 ;doc: update manuals 2022-06-05 00:02:59 +01:00
Simon Michael
d27a581e0f ;doc: update changelogs 2022-06-04 11:28:59 +01:00
Simon Michael
faa05764d7 ;cabal: update cabal files 2022-06-04 11:24:56 +01:00
Simon Michael
05dffe5029 imp: lib: allow doclayout 0.4 2022-06-04 11:24:35 +01:00
Stephen Morgan
9155d679fe fix!: Revert "fix!: utf-8: Use with-utf8 to ensure all files are read and written with utf8 encoding. (#1619)"
This reverts commit e233f001c5.

This would break at least some people's workflow. A lighter touch is
probably sufficient.
2022-06-01 09:35:18 +10:00
Simon Michael
1085a2a777 ;doc: update changelogs 2022-05-29 08:05:33 -10:00
Simon Michael
2bce910904 ;doc: update manuals 2022-05-25 11:35:47 -10:00
Simon Michael
a9779b2377 ref: move journal checking/pretty errors down further, to Hledger.Data
now at Hledger.Data.JournalChecks*, Hledger.Data.Errors
2022-05-21 18:29:13 -10:00
Simon Michael
307f723b0a lib: simpler, more consistent names for check functions
API changes:
journalCheckAccountsDeclared
journalCheckCommoditiesDeclared
journalCheckPayeesDeclared
->
journalCheckAccounts
journalCheckCommodities
journalCheckPayees
2022-05-21 18:29:13 -10:00
Simon Michael
65e913b7c5
Merge pull request #1834 from Xitian9/utf8
Use with-utf8 and don't use Data.Text.IO.
2022-05-21 17:50:59 -10:00
Stephen Morgan
e233f001c5 fix!: utf-8: Use with-utf8 to ensure all files are read and written with utf8 encoding. (#1619)
May also fix #1154, #1033, #708, #536, #73: testing is needed.

This aims to solve all problems where misconfigured locales lead to
parsers failing on utf8-encoded data. This should hopefully avoid
encoding issues, but since it fundamentally alters how encoding is dealt
with it may lead to unexpected outcomes. Widespread testing on a number
of different platforms would be useful.
2022-05-22 13:12:19 +10:00
Stephen Morgan
15a5d5d38b
Merge pull request #1814 from Xitian9/csverror
imp: csv: Give an error if unable to substitute csv templates. (#1803)
2022-05-22 11:35:39 +10:00
Simon Michael
db26456e1c imp: consolidate ordereddates check under Hledger.Read.Checks too
And remove the last vestiges of older more complex behaviour.
ordereddates now always checks all transactions in each file,
unaffected by a query. (But still affected by --date2).
2022-05-09 00:05:39 -10:00
Simon Michael
810a868c88 ref: consolidate most checks under Hledger.Read.Checks
and error message helpers in Hledger.Read.Error.
2022-05-09 00:04:33 -10:00
Simon Michael
2f8f922256 dev: fix doctests after "Error: " addition (#1436) 2022-04-25 02:56:59 -10:00
Simon Michael
a00dc04e0d imp: check: uniqueleafnames: use the standard error format (#1436)
Hledger.Read.Common:
export makePostingErrorExcerpt
2022-04-25 02:56:59 -10:00
Simon Michael
7e45ab338f imp: check: show column ranges properly (#1436) 2022-04-25 02:56:59 -10:00
Simon Michael
66d0beea5e imp: check: ordereddates: use the standard error format (#1436)
Hledger.Read.Common:
export makeTransactionErrorExcerpt
2022-04-25 02:56:59 -10:00
Simon Michael
792434ca7d imp: check: payees: use the standard error format (#1436) 2022-04-25 02:56:59 -10:00
Simon Michael
c7e8f58c33 imp: check: mark all error columns when that's preferable (#1436)
Undeclared commodity errors now mark the whole amount and assertion
region, since locating the exact position of commodity symbols is
difficult.
2022-04-25 02:56:59 -10:00
Simon Michael
8f4405e628 dev: check: refactor error messages (#1436) 2022-04-25 02:56:59 -10:00
Simon Michael
6ec0e05c42 imp: check: commodities: use the standard error format (#1436) 2022-04-25 02:56:59 -10:00
Simon Michael
4b3644d780 imp: check: accounts: print a standardised error message like megaparsec's (#1436)
added:
formatExcerptLikeMegaparsec
2022-04-25 02:56:59 -10:00
Simon Michael
f47d423a67 lib: error' now adds an Error: prefix 2022-04-25 02:56:59 -10:00
Simon Michael
5ab7b9f643 ref: HledgerParseErrors type alias 2022-04-25 02:56:59 -10:00
Simon Michael
2f28e1b0a7 ref: rename CustomErr -> HledgerParseErrorData
Verbose, but use every chance to clarify the complicated parse error
situation.
2022-04-25 02:56:59 -10:00
Simon Michael
81ad760e49 test: disable doctest for all but GHC 9.2 2022-04-25 01:36:14 -10:00
Simon Michael
353312e045 lib: enable doctests with GHC 9.2+ (#1503)
https://github.com/sol/doctest/issues/301 /
https://github.com/sol/doctest/issues/327
seem to be specific to GHC 9.0.
2022-04-25 00:33:07 -10:00
Simon Michael
53332ee6a5 stack: re-enable hledger-web with ghc 9.2 2022-04-15 15:07:17 -10:00
Simon Michael
133c54434a ;doc: changelogs 2022-04-14 13:59:03 -10:00
Simon Michael
8de85be658 ;doc: update manuals 2022-04-14 12:39:18 -10:00
Simon Michael
5af224d534 fix: tags: also match accounts declared but not used (#1857)
By default, all account declarations and all transactions are searched;
but when there's a query involving transaction fields,
account declarations unrelated to the matched transactions are not searched.

added:
queryIsCode
queryIsTransactionRelated
2022-04-14 12:28:43 -10:00
Simon Michael
4f26309328 ref: clean up Query definition 2022-04-14 11:56:37 -10:00
Simon Michael
161c911cb4 imp: Hledger.Query: new predicates, haddock cleanups
added:
matchesQuery,
queryIsAccountRelated,
queryIsTransactionOrPostingRelated,
2022-04-14 10:58:31 -10:00
Stephen Morgan
8cc59df513 fix: Ensure date2 is used for journal valuation if requested. (#1851) 2022-04-14 07:27:17 -10:00
Simon Michael
aa3807e157 ref: journalAccountTypes 2022-04-11 09:18:23 -10:00
Stephen Morgan
c48d98c515 imp: csv: Substitute empty string if csv template fails. (#1803) 2022-03-29 18:03:33 +11:00
Stephen Morgan
1aff74f702 cln: Reduce duplication in test utilities. 2022-03-26 15:35:19 -10:00
Stephen Morgan
8968733630 cln!: Clean up journal parsing.
parseAndFinaliseJournal' has been removed. In the unlikely event you
needed it in your code, you can replace it with:
parseAndFinaliseJournal' parser iopts fp t =>
initialiseAndParseJournal parser iopts fp t
>>= liftEither . journalApplyAliases (aliasesFromOpts iopts)
>>= journalFinalise iopts fp t

Some parsers have been generalised from JournalParser to TextParser.
2022-03-26 15:35:19 -10:00
Simon Michael
a2f6b30fbd cln: silence some warnings/lints 2022-03-26 08:34:21 -10:00
Simon Michael
db1818ac4a imp: consistent ghc warnings 2022-03-26 08:27:29 -10:00
Simon Michael
d9ecd1eb9d imp: update to modern warning flags 2022-03-25 20:28:34 -10:00
Stephen Morgan
bffb6c8c82 ref: smartdate: Improve ergonomics of SmartDate constructors. 2022-03-25 19:10:58 -10:00
Simon Michael
d60e1464d5 imp: fix MonadIO import (#1847) 2022-03-25 14:49:56 -10:00
Stephen Morgan
31c7c5d1ca fix: Clean up build failures due to redundant imports and duplicate
function.
2022-03-26 11:37:32 +11:00
Stephen Morgan
603b2e9f09 ref: Use ExceptT String IO a instead of IO (Either String a).
This increases composability and avoids some ugly case handling. We
re-export runExceptT in Hledger.Read.

The final return types of the following functions has been changed from
IO (Either String a) to ExceptT String IO a. If this causes a problem,
you can get the old behaviour by calling runExceptT on the output:
readJournal, readJournalFiles, readJournalFile

Or, you can use the easy functions readJournal', readJournalFiles', and
readJournalFile', which assume default options and return in the IO
monad.
2022-03-25 14:23:27 -10:00
Simon Michael
5281c5d647 imp: allow pivoting on 'status' also 2022-03-18 21:38:31 -10:00
Simon Michael
b584774a03 ci: fix a typo I fat-fingered 2022-03-18 11:03:30 -10:00
Simon Michael
2b2d643333 test: errors: make tests runnable 2022-03-18 06:59:33 -10:00
Stephen Morgan
e6bf04fce3 fix: aliases: Make sure we can escape forward slashes in account
aliases, but otherwise the regular expression handler handles escapes.
2022-03-16 19:01:03 -10:00
Stephen Morgan
4a80551406 fix: price: Make sure inferred market prices have the correct sign with
total prices. (#1813)

Also reduce duplication for inferring market prices (previously it was
done separately in both Hledger.Data.Journal and
Hledger.Cli.Commands.Prices), and remove *TotalPriceToUnitPrice
functions, since unit prices cannot represent all total prices.

Add a helper function numDigitsInt to get the number of digits in an
integer, which has a surprising number of ways to get it wrong.
2022-03-10 17:34:49 -10:00
Stephen Morgan
45408183fe dev: reg: areg: Strip prices early on in PostingsReport and AccountTransactionsReport, when possible.
This results in big speedups in cases when we have many transaction prices, like in examples/10000x1000x10.journal. This can be disabled with the show_costs_ option in ReportOpts.
2022-03-10 17:21:40 -10:00
Stephen Morgan
a65e64115a fix: alias: Allow escaped characters in regular expression aliases. (#982) 2022-03-10 17:00:03 -10:00
Stephen Morgan
19ed6d3f00 cln!: sourcepos: Use megaparsec-supplied sourcePosPretty.
Change showSourcePos to sourcePosPretty, and showSourcePosPair to
sourcePosPairPretty.
2022-03-10 16:56:28 -10:00
Simon Michael
f0e00b3a43 ;doc: update changelogs 2022-03-10 16:55:46 -10:00
Simon Michael
af7a5f98e3 ;cabal: update cabal files 2022-03-05 13:24:48 -10:00
Simon Michael
5aab2cbf40 ;pkg: bump version to 1.25.99 2022-03-05 13:24:48 -10:00
Simon Michael
e4ca7187fe doc: finalise changelogs for 1.25 2022-03-04 17:51:59 -10:00
Simon Michael
2ee914bdc7 ;doc: update changelogs 2022-03-04 17:04:50 -10:00
Simon Michael
e9c19e12ef ;cln: redundant pragma 2022-02-11 09:22:26 -10:00
Simon Michael
44211c1c57 ref: move Posting account name fns to AccountName
accountNamePostingType  accountNameWithoutPostingType  accountNameWithPostingType
joinAccountNames
concatAccountNames
accountNameApplyAliases  accountNameApplyAliasesMemo
2022-02-11 09:18:35 -10:00
Simon Michael
41d7c7f6b3 doc: lib: changelog fix 2022-02-07 11:58:29 -10:00
Stephen Morgan
2f47ae05c6 fix: csv: Allow unicode in field references for csv. (#1809) 2022-02-06 14:16:17 -10:00
Simon Michael
71f9c7985f doc: changelog updates from release branch 2022-02-05 22:09:20 -10:00
Simon Michael
ef4da90538 ;doc: update changelogs 2022-02-05 14:57:53 -10:00
Stephen Morgan
31fdcdb8ef !imp: type: Change the default account inference for Cash accounts to only match
^assets?(:.+)?:(cash|bank|che(ck|que?)(ing)?|savings?|current)(:|$)

This should have no effect outside the cash report.

The rule for auto-detecting "Cash" (liquid assets) from account names
has changed in this release - see [Account types]. This is to simplify
how account types are detected and configured. If you use the cashflow
report without explicitly declaring accounts as Cash, you might notice a
change, and might need to add explicit account type: tags.
2022-02-03 15:32:00 -10:00
Stephen Morgan
2e4cfccf1b fix: types: Make sure type: query will correctly match subtypes, so
type:a will also match cash accounts, and type:e will also match
conversion accounts.
2022-02-03 15:32:00 -10:00
Stephen Morgan
73925ae965 fix: types: Ensure auto postings can match against and be matched by type: queries.
This requires checking parent accounts for any new accounts introduced by auto postings which do not exist in the original journal.

Also refactor journalFinalise to only call journalPostingsAddAccountTags once, and use fewer intermediate variables.
2022-02-03 15:32:00 -10:00
Stephen Morgan
a16c88b1b1 fix: Make sure cash and conversion account types are correctly
determined when there are no explicit declarations.
2022-02-03 15:32:00 -10:00
Stephen Morgan
36fe6bbcff fix: Allow accountNameInferType to recognise Conversion accounts. 2022-02-03 15:32:00 -10:00
Stephen Morgan
e17cd1540d fix: Correctly infer Cash accounts using accountNameInferType. 2022-02-03 15:32:00 -10:00
Simon Michael
807717805a feat: accounts: --types shows account types (#1820) 2022-02-01 18:06:19 -10:00
Simon Michael
a22068a556 imp: better error messages for type:'s argument 2022-01-31 16:44:13 -10:00
Simon Michael
45127dc5f5 feat: new type: query for easy matching by account type
type:TYPES, where TYPES is any of the (case insensitive) letters
ALERXCV, matches accounts by their declared or inferred type.
(See https://hledger.org/hledger.html#account-types.)
This should work with most commands, eg:

    hledger bal type:al
    hledger reg type:x

API changes:

Journal has a new jaccounttypes map.
The journalAccountType lookup function makes it easy to check an account's type.
The journalTags and journalInheritedTags functions look up an account's tags.
Functions like journalFilterPostings and journalFilterTransactions,
and new matching functions matchesAccountExtra, matchesPostingExtra
and matchesTransactionExtra, use these to allow more powerful matching
that is aware of account types and tags.
2022-01-31 16:44:13 -10:00
Simon Michael
885a4fcfec ref: journalFinalise: clarify sequence, top to bottom 2022-01-31 16:44:13 -10:00
Simon Michael
248ddf9378 dev: more thorough Journal anonymisation, and a note (#1817) 2022-01-30 09:47:52 -10:00
Simon Michael
56be63e6f1 feat: queries can now match account tags (#1817)
Accounts, postings, and transactions can now all be filtered by the
tags in an account's declaration. In particular it's now possible to
more reliably select accounts by type, using their type: tag rather
than their name:

    account myasset       ; type:Asset
    account myliability   ; type:Liability

    $ hledger accounts tag:type=^a
    myasset

Accounts inherit tags from their parents.

API changes:
A finalised Journal has a new jdeclaredaccounttags field
for easy lookup of account tags.
Query.matchesTaggedAccount is a tag-aware version of matchesAccount.
2022-01-30 09:47:52 -10:00
Simon Michael
4ed80d4069 ;doc: update journalFinalise haddock 2022-01-30 09:47:52 -10:00
Stephen Morgan
df4949ad1a imp!: journal: Remove deprecated account type code syntax from account
directives.

Previously, you declare an account type with the following format:
account assets  A
This has been deprecated since 1.13, and should now be declared with one
of:
account assets  ; type:A
account assets  ; type:asset
2022-01-28 12:38:38 -10:00
Simon Michael
929f13ec03 fix: warning (#1799) 2022-01-26 09:00:40 -10:00
Simon Michael
27b6e1d111 imp: nicer invalid balance assignment errors (tweak) 2022-01-26 08:59:19 -10:00
Stephen Morgan
ba0eec9132 ref: Return the interval split in reportSpan, to reduce the number
of different places we call splitSpan and ease refactoring.
2022-01-26 08:05:37 -10:00
Stephen Morgan
e33de3585b ref: Clean up splitSpan, to make the logic clearer and more extensible.
Previously the helper functions splitspan and splitspan' would calculate
each span from the start point of the previous span. This meant we had
to be very careful not to lose any relevant information (e.g. what day
of the week it was) about the original start date. We now calculate each
span from the original start date, so there's no risk of losing
information. This simplifies many of the calculations.
2022-01-26 08:05:37 -10:00
Stephen Morgan
ea51a87bd0 cln: Remove under-used maybePeriod, which is only used as a stand-in for
Just . parsePeriodExpr' in tests.
2022-01-26 08:05:37 -10:00
Stephen Morgan
43b7e849c7 cln: Remove some explicit Text packing. 2022-01-26 08:05:37 -10:00
Stephen Morgan
55a022a941 fix: strict: Make sure forecast transactions and auto postings are
checked with --strict. (#1810)
2022-01-26 07:57:13 -10:00
Simon Michael
30080a9aa1 imp: nicer invalid balance assignment errors 2022-01-21 17:33:19 -10:00
Stephen Morgan
8cd9e81c34 fix: budget: Make sure boring parents of unbudgeted accounts are not
elided if they have a budget. (#1800)

This only affects calls with --budget and -E, but not with --no-elide.
2022-01-21 09:11:04 -10:00
Simon Michael
d9b0184720 ;doc: changeslogs: edit 2022-01-21 08:38:59 -10:00
Simon Michael
8daef36c29 ;doc: update changelogs 2022-01-21 08:32:29 -10:00
Simon Michael
f36ab179c4 ;doc: add interim note re ConversionOp (#1808) 2022-01-16 18:43:40 -10:00
Stephen Morgan
57d055b643 fix: cost: Add inferred equity postings during journal finalisation, so
they can be matched by queries.
2022-01-16 18:37:18 -10:00
Stephen Morgan
5006e26995 imp: check: Do not check commodities for zero amounts with empty
commodity. (#1767)
2022-01-16 08:11:02 -10:00
Simon Michael
9444e20c3d ;doc: update changelogs 2022-01-15 08:56:45 -10:00
Stephen Morgan
f13ac2812f imp: smartdates: Simplify and generalise the SmartDate constructor and
parsers to allow for arbitrary numbers of periods in relative dates.

We now accept smart dates like “in 5 days, 5 weeks ahead, in -6 months, 2 quarters ago”.
2022-01-11 13:31:29 -10:00
Simon Michael
0e5ae2baac ;doc: update changelogs 2022-01-06 06:42:34 -10:00
Simon Michael
d82210cea9 ;doc: update changelogs 2022-01-05 18:09:23 -10:00
Simon Michael
757c548c17 ;doc: update changelogs 2022-01-05 08:12:44 -10:00
Simon Michael
d1bc3bbb32 ;doc: update changelogs 2022-01-01 15:55:08 -10:00
Stephen Morgan
e9dd77e82b fix: Ensure head and tail are not called on empty account names. 2021-12-22 14:37:37 -10:00
Stephen Morgan
8eedbbbe87 imp: cost: Generate totally balanced conversion postings for amounts with costs.
Introduce --infer-equity option which will generate conversion postings.
--cost will override --infer-equity.

This means there will no longer be unbalanced transactions, but will be
offsetting conversion postings to balance things out. For example.

2000-01-01
  a   1 AAA @@ 2 BBB
  b  -2 BBB

When converting to cost, this is treated the same as before.
When used with --infer-equity, this is now treated as:

2000-01-01
  a                               1 AAA
  equity:conversion:AAA-BBB:AAA  -1 AAA
  equity:conversion:AAA-BBB:BBB   2 BBB
  b                              -2 BBB

There is a new account type, Conversion/V, which is a subtype of Equity/E.
The first account declared with this type, if any, is used as the base account
for inferred equity postings in conversion transactions, overriding the default
"equity:conversion".

API changes:

Costing has been changed to ConversionOp with three options:
NoConversionOp, ToCost, and InferEquity.
The first correspond to the previous NoCost and Cost options, while the
third corresponds to the --infer-equity flag.  This converts transactions with costs
(one or more transaction prices) to transactions with equity:conversion postings.
It is in ConversionOp because converting to cost with -B/--cost and inferring conversion
equity postings with --infer-equity are mutually exclusive.

Correspondingly, the cost_ record of ReportOpts has been changed to
conversionop_.

This also removes show_costs_ option in ReportOpts, as its functionality
has been replaced by the richer cost_ option.
2021-12-21 10:50:13 -10:00
Simon Michael
45db32b84f ;doc: update changelogs 2021-12-10 12:50:21 -10:00
Simon Michael
a98e6125f1 ;doc: changelogs: 1.24.1 2021-12-10 12:47:43 -10:00
Simon Michael
1a646cd092 ;doc: changelogs: 1.24.1 2021-12-09 14:52:23 -10:00
Simon Michael
f111274f25 ;doc: update changelogs 2021-12-09 14:25:42 -10:00
Simon Michael
43d935efda fix: ui: declared accounts respect not:ACCT (another #1783 fix) 2021-12-09 13:45:57 -10:00
Simon Michael
d1a0d37bd1 fix: bal: --declared now respects not:ACCT (fix #1783) 2021-12-09 12:58:22 -10:00
Simon Michael
25598a231f lib: clarify filterQuery, add filterQueryOrNotQuery (#1783) 2021-12-09 12:57:26 -10:00
Simon Michael
900e2167fc fix: bal: better fix for treeLeaves, fixing func tests (#1782) 2021-12-08 18:14:08 -10:00
Simon Michael
2bb309b073 fix: ui: don't show root account, respect not:ACCT (fix #1782) 2021-12-08 17:17:57 -10:00
Simon Michael
0d83bdf6d7 cln: csv: small rename 2021-12-08 16:57:53 -10:00
Stephen Morgan
c4004fca28 imp: csv: Do not display thousands separators when outputting csv. 2021-12-06 15:17:46 -10:00
Simon Michael
35c1c9b6a2 pkg: progress towards supporting GHC 9.2 and newer libs (#1774)
hledger-lib builds, hledger's deps don't (shakespeare).
2021-12-06 12:32:50 -10:00
Stephen Morgan
7ccf7430d0 imp: csv: Allow for generating tidy csv with --layout=tidy.
This puts every date in a separate row, which is more suitable for
many graphing programs.
2021-12-05 16:06:44 -10:00
Stephen Morgan
3884f90cc6 lib!: Rename CommodityLayout to Layout and rename constructors.
Their scope is more than just commodities.
2021-12-05 16:06:44 -10:00
Simon Michael
ce3ec28e3d ;cabal: update cabal files 2021-12-01 22:16:37 -10:00
Simon Michael
66619803b7 ;pkg: bump version to 1.24.99 2021-12-01 22:16:37 -10:00
Simon Michael
2382fe5db8 ;doc: finalise changelogs 2021-12-01 18:23:16 -10:00
Simon Michael
0c4b820111 ;cabal: update cabal files 2021-12-01 17:16:28 -10:00
Simon Michael
387325b59e ;pkg: bump version to 1.24 2021-12-01 17:16:28 -10:00
Simon Michael
1d3f7a2aad ;doc: update manuals 2021-12-01 17:16:04 -10:00
Simon Michael
55f5aa9238 ;doc: changelog edits 2021-11-26 21:06:52 -10:00
Simon Michael
4933b9fc45 ;doc: draft changelogs 2021-11-26 12:02:36 -10:00
Simon Michael
7e47d36451 ;cln: typo 2021-11-25 11:55:58 -10:00
Simon Michael
7f320ebfa9 imp: balcmds: support --declared on bs/cf/is also (#1765) 2021-11-25 11:55:58 -10:00
Simon Michael
6319d6148f feat: bal: with --declared, include declared leaf accounts (#1765)
Together with -E, this shows a balance for both used and declared
accounts (excluding empty parent accounts, which are usually not
wanted in list-mode reports).

This is somewhat consistent with --declared in the accounts and payees
commands, except for the leaf account restriction.

The idea of this is to be able to see a useful "complete" balance
report, even when you don't have transactions in all of your declared
accounts yet. I mainly want this for hledger-ui, but there's no harm
in exposing it in the balance CLI as well.
2021-11-23 09:47:04 -10:00
Simon Michael
94d92b9760 Revert "feat: bal: with --declared, include all declared accounts (#1765)"
This reverts commit a5e19b7391.
(It breaks filtering by account.)
2021-11-22 12:06:23 -10:00
Simon Michael
a5e19b7391
feat: bal: with --declared, include all declared accounts (#1765)
Together with -E, this allows showing a balance for all accounts, both
used and declared. I mainly want this for hledger-ui, but there's no
harm in exposing it in the balance command as well. This is somewhat
consistent with the accounts and payees commands.
2021-11-22 11:08:33 -10:00
Simon Michael
1fee70b51f cln: hlint cleanups 2021-11-21 19:33:21 -10:00
Stephen Morgan
186995fc8b fix: balance: Balance reports with --depth=0 should report on true
values, not zero everywhere. (#1761)
2021-11-20 15:47:57 -10:00
Simon Michael
3c889cb565 imp: lib: dlog 2021-11-20 07:49:41 -10:00
Simon Michael
cf15dbd7c9 ;doc: update manuals 2021-11-18 22:26:10 -10:00
Lawrence
fb817ffa55 imp: journal: support decimal-mark directive in journal files
To match csv-rule and override amount-style as described in
https://github.com/simonmichael/hledger/issues/1670
2021-11-18 22:17:07 -10:00
Stephen Morgan
d82416b7b9 imp: balance: Add single-line display with elision back in, this time
with a separate option --layout=wide,WIDTH.
2021-11-18 21:26:02 -10:00
Stephen Morgan
7e21f05a83 imp: balance: Implement multi-line display for multicommodity balance reports.
This allows more control over how multicommodity amounts are displayed.
In addition to the default single-line display, and the recent commodity
column display, we now have multi-line display. This is controlled by
the --layout option, which has possible values "wide", "tall", and
"bare". The --commodity-column option has been hidden, but is equivalent
to --layout=bare.

squash
2021-11-18 21:26:02 -10:00
Stephen Morgan
1c90c7f97a fix: prices: Do not include zero amounts when calculating amounts for balance assignments. (#1736)
This is not usually a problem, but can get in the way of auto-inferring prices.
2021-11-18 20:59:52 -10:00
Stephen Morgan
e35d0b7865 fix: csv: Successfully parse empty csv file. (#1183) 2021-11-18 20:50:02 -10:00
Stephen Morgan
87a7a586d4 fix: csv: Handle multiple zero amounts in postings in csv files. (#1733) 2021-11-18 20:48:55 -10:00
Stephen Morgan
c6beb581a1 pkg: Use maximumBound instead of maximumDef to avoid deprecation
warnings in safe-0.3.18.
2021-11-14 21:49:58 -10:00
Stephen Morgan
8d161ebe32 cln: Silence build warning due to redundant import. 2021-11-11 19:42:06 -10:00
Stephen Morgan
ff0132df28 dev: Use realLength from doclayout instead of strWidth and textWidth. (#895)
This gives us more accurate string length calculations. In particular,
it handles emoji and other scripts properly.
2021-11-11 18:29:50 -10:00
Stephen Morgan
38e311211d lib!: Semigroup instance of PeriodicReportRow and PeriodicReport now
preserves first prrName, rather than the second.

Previously the second name would be taken, ignoring the first.
2021-11-07 07:56:08 -10:00
Stephen Morgan
1116846881 lib: Add Bifunctor instances for PeriodicReport and PeriodicReportRow. 2021-11-07 07:56:08 -10:00
Stephen Morgan
7597e525a3 fix: balance: Balance reports should consider date: queries when calculating
report span with --date2. (#1745)
2021-11-06 08:51:53 -10:00
Simon Michael
41bde20095 timedot: a D default commodity (and style) is applied to timedot aounts
This means they can be priced and converted.
2021-11-05 23:34:46 -10:00
Simon Michael
f00e5c25ec cln: fix warning 2021-11-05 23:32:47 -10:00
Stephen Morgan
1bc04685b7 pkg: Drop base-compat-batteries dependency.
Our supported stackage versions are now new enough that we don't need
any of the compatibility features anymore.
2021-10-31 07:56:07 -10:00
Stephen Morgan
c90e7dbc8d cln: Move posting rendering functions into Hledger.Data.Posting.
Replace showPosting with a wrapper around postingAsLines.

The functions textConcat(Top|Bottom)Padded are no longer used anywhere
in the code base, and can be removed if desired.

This produces slightly different output for showPosting, in particular
it no longer displays the transaction date. However, this has been
marked as ‘for debugging only’ for a while, and is only used in
hledger-check-fancy assertions. The output there is still acceptable.
2021-10-31 07:50:50 -10:00
Simon Michael
e4263e69e1 areg: begin respecting --date2: show txns' date2 (#1731) 2021-10-10 10:34:45 -10:00
Simon Michael
b4c1188c26 ref!: postingDateOrDate2, transactionDateOrDate2, whichDateFromOpts -> whichDate (#1731) 2021-10-10 10:34:35 -10:00
Simon Michael
7af2e79465 ;cabal: update cabal files 2021-10-03 22:56:02 -10:00
Simon Michael
69905dbc25 ;pkg: allow megaparsec 9.2 2021-10-03 22:55:10 -10:00
Stephen Morgan
5aadcdea4d ref: Add new helper functions journalValueAndFilterPostings(With)?.
Combining valuation with filtration is subtle and error-prone (see e.g. #1625).
We have to do in in both MultiBalanceReport and PostingsReport, where it
is done in slightly different ways. This refactors this functionality
into separate functions which are called in both reports, for uniform
behaviour.
2021-09-26 08:13:12 -10:00
Simon Michael
b857307f64 ;cabal: update cabal files 2021-09-24 12:22:15 -10:00
Simon Michael
8934c115bd ;pkg: bump version to 1.23.99 2021-09-24 12:22:15 -10:00
Stephen Morgan
ce4fcfae84 imp!: value: For register reports with no reporting interval and
--value=end, historical reports should be valued at journal/report end
date.
2021-09-24 11:32:41 -10:00
Simon Michael
e90fa3ee81 doc: changelogs: cleanup, finalise 2021-09-21 17:15:39 -10:00
Simon Michael
72a4c82043 cli: tweak --pretty help 2021-09-21 17:15:39 -10:00
Simon Michael
1b020e004b ;cabal: update cabal files 2021-09-21 15:34:23 -10:00
Simon Michael
19950df745 ;pkg: bump version to 1.23 2021-09-21 15:34:23 -10:00
Stephen Morgan
afdeb404b0 fix: colour: NO_COLOR flag no longer overrides an explicit --color option. (#1710)
http://no-color.org/ specifies that command line arguments should
override a NO_COLOR flag.
2021-09-21 15:32:53 -10:00
Stephen Morgan
399d28dc05 cln: Display friendly error message if --pretty is given an incorrect
argument.
2021-09-21 15:32:09 -10:00
Stephen Morgan
bf3e82f780 imp: pretty: Replace --pretty-tables argument with --pretty=WHEN
argument, which takes yes or no. Default is no for now.
2021-09-21 14:53:52 -10:00
Simon Michael
bb4f2ff34f ;doc: update changelogs 2021-09-20 17:58:29 -10:00
Stephen Morgan
378df77001 cln: Remove unnecessary normaliseMixedAmount(SquashPricesForDisplay)? functions. 2021-09-20 14:49:34 -10:00
Arjen Langebaerd
c0fd79a40e fix: extend application of commodity style to prices (except precision) and make --commodity-style a general flag 2021-09-20 08:55:55 -10:00
Stephen Morgan
4cfd3cb590 lib!: Remove GenericSourcePos, and replace it with either SourcePos or
(SourcePos, SourcePos).

This has been marked for possible removal for a while. We are keeping
strictly more information. Possible edge cases arise with Timeclock and
CsvReader, but I think these are covered.

The particular motivation for getting rid of this is that
GenericSourcePos is creating some awkward import considerations for
little gain. Removing this enables some flattening of the module
dependency tree.
2021-09-20 08:38:33 -10:00
Stephen Morgan
df71d2ddd5 dev: Move journal and text parsing utilities into more appropriate places, to reduce reliance on Hledger.Read.Common. 2021-09-19 17:10:38 -10:00
Stephen Morgan
1e766e481e cln: Flatten dependency tree by removing dependencies of Hledger.Reports
on Hledger.Read.

This is done by using equivalent functions/types defined elsewhere
instead.
2021-09-19 17:10:38 -10:00
Stephen Morgan
315e92c08b pkg!: Break functions related to balancing out into a separate module,
Hledger.Data.Balancing.

Both Hledger.Data.Transaction and Hledger.Data.Journal are massive
module with many things in them. Placing the balancing functions, which
are conceptually related, into a separate module helps keep things more
modular.

It also reduces the risk of import cycles, as right now balancing
functions cannot depend on any functions defined outside of
Hledger.Data.Transaction or Hledger.Data.Journal, respectively, if those
modules require basic transaction or journal functions.
2021-09-19 17:10:38 -10:00
Stephen Morgan
d55ce4d759 ref: performance: Use a Set in accountNamesFromPostings, instead of
nubSort.

This has better performance when there is repetition in the account
names.
2021-09-18 16:00:55 -10:00
Stephen Morgan
ab5350e02c ref: performance: Improve performance for some high-use functions.
mixedAmount(Looks|Is)Zero now operate directly on the MixedAmount,
rather than converting them to a list of amounts first.

mixedAmountCost no longer reconstructs the entire MixedAmount when there
are amounts with no cost.

transactionCheckBalanced only checks if signs are okay if sums are not
okay. It also only traverses the list of postings once when picking real
and balanced virtual postings.
2021-09-18 16:00:55 -10:00
Stephen Morgan
a2d7ac5318 ref: balance: Refactor getPostingsByColumn to use groupByDateSpan.
This reduces code duplication, makes the code more idiomatic, and hides
optimisation magic within groupByDateSpan.
2021-09-18 14:40:28 -10:00
Stephen Morgan
35c33f342b cln: Move column grouping functions form Report.PostingsReport to Data.Dates. 2021-09-18 14:40:28 -10:00
Malte Brandy
e31eb58ada lib: Allow multiline comments in csv rules 2021-09-18 12:43:49 -10:00
Simon Michael
326d6e8dae ref: ReportOptions{infer_value_} renamed to infer_prices_
For more consistency with the flag name (--infer-market-prices).
And BalancingOpts{infer_prices_} is now infer_transaction_prices_.
2021-09-18 12:12:31 -10:00
Simon Michael
daa9fddec9 imp: cli: --infer-market-price renamed to --infer-market-prices
It was too easy to get this wrong, even some of the docs did.
Now either plural or singular spelling works
(since we accept flag prefixes).
2021-09-18 12:12:31 -10:00
Stephen Morgan
9f5b652b4e cln: Clean up miscellaneous functions in Hledger.Data.Amount.
This makes imports more explicit, removes printf, and adds stack traces
to unimplemented calls to Num instances for mixed amounts.
2021-09-18 11:41:53 -10:00
Stephen Morgan
020dd15be4 ref: Simplify parsing of commodity-style option. 2021-09-18 11:41:53 -10:00
Stephen Morgan
6b400194e3 cln: Add explicit export list for Hledger.Data.Account.
All modules in hledger-lib now have explicit export lists, with the
exception of Hledger.Data.Types.
2021-09-18 11:41:53 -10:00
Stephen Morgan
c1d85ba17c ref: Move JournalParser and ErroringJournalParser to Hledger.Data.Journal.
This is so that Hledger.Utils does not depend on Hledger.Data in any
way, and allows us more flexibility in refactoring Hledger.Data.
2021-09-18 11:41:53 -10:00
Stephen Morgan
62351dd329 fix: bal: Make sure boring parent accounts in compound balance reports
include historical postings when account declarations have undeclared
parents. (#1698)
2021-09-17 15:24:19 -10:00
Stephen Morgan
3b5262e54a fix: performance: Speed up PostingsReport when called with a large number of intervals. (#1683)
It is still very slow for large journals, but at least it doesn't run
any slower for interval reports.
2021-09-16 17:40:24 -10:00
Simon Michael
7a249cffe9 ;doc: update manuals 2021-09-09 14:45:01 -10:00
Stephen Morgan
0f205295e8 pkg!: test: Use --today in Journal parsing functions. 2021-09-09 14:40:39 -10:00
Stephen Morgan
6905e40c4d pkg!: cli: Add --today option to explicitly set the current date. (#1674)
rawOptsTo* in hledger-lib now takes a day as an argument, and does not
live in the IO monad, since it's now pure.

This is so that we can run tests containing future transactions that
won't fail as soon as ‘the future’ actually arrives.
2021-09-09 14:40:39 -10:00
Stephen Morgan
50f73b7434 fix: balance: Show all empty accounts in flat balance reports. (#1688)
Previously we only showed empty leaves.
2021-09-08 18:17:27 -10:00
Simon Michael
5485990cac fix: csv: report correct CSV line number in errors
Some errors in CSV conversion, such as a failing balance assertion,
were always being reported as line 2.
Reported by Lawrence Wu.
2021-09-01 06:58:15 -10:00
Stephen Morgan
8274da81fc cln: tests: Remove test and tests, which are just aliases for testCase
and testGroup.

Replacing these removes a layer of indirection, and reduces the need to
depend on Hledger.Utils.Test.
2021-08-30 16:32:19 -10:00
Stephen Morgan
1c402edb06 pkg!: Remove Hledger.Data.Commodity module.
There are no modules which depend on Hledger.Data.Commodity which don't
also depend on Hledger.Data.Amount. Though Hledger.Data.Amount is a very
large module and might be broken up, Hledger.Data.Commodity only defines
three very small functions which are used, and so can be combined with
little cost.
2021-08-30 15:57:33 -10:00
Stephen Morgan
a0f9d7560f pkg!: Remove Hledger.Utils.Color module.
This module was only used in one place in Hledger.Data.Amount. The code
has been moved directly into Hledger.Utils.
2021-08-30 15:57:33 -10:00
Stephen Morgan
f1994d5aa8 pkg!: Remove Hledger.Utils.Tree module.
This very small module was only used in Hledger.Data.Account, so the
code was moved into that module instead.
2021-08-30 15:57:33 -10:00
Stephen Morgan
1ed06f3bc8 pkg!: Remove Hledger.Utils.UTF8IOCompat module.
This module does nothing beyond define error' and usageError, which have
been moved to Hledger.Utils.
2021-08-30 15:57:33 -10:00
Stephen Morgan
f3eacebc1d dev: lens: Use TemplateHaskell for ReportOpts and ReportSpec.
Also rename overWithReport/setWithReport to overEither/setEither.
2021-08-28 19:12:04 -10:00
Stephen Morgan
435ec992f9 dev: lens: Introduce lenses for InputOpts and BalancingOpts. 2021-08-28 19:12:04 -10:00
Stephen Morgan
c784da3d0c dev: lens: Create a Template Haskell helper for generating classy lenses
for hledger options.

This works for BalancingOpts, InputOpts, ReportOpts, ReportSpec, and CliOpts.
2021-08-28 19:12:04 -10:00
Stephen Morgan
13206d0b18 cln: Rename balancingOpts to defbalancingopts, to be consistent with definputopts, defreportopts, etc. 2021-08-28 19:12:04 -10:00
Stephen Morgan
d248aec313 cln: hlint: Remove eta reduce warnings. 2021-08-27 06:13:56 -10:00
Stephen Morgan
32dad455fd cln: hlint: Clean up section related warnings. 2021-08-27 06:13:56 -10:00
Stephen Morgan
761e00caa4 cln: hlint: Clean up lambda related warnings. 2021-08-27 06:13:56 -10:00
Stephen Morgan
8bf7c95697 cln: hlint: Clean up Functor related hlint warnings, and NOINLINE warning. 2021-08-27 06:13:56 -10:00
Stephen Morgan
21e62ffcbd cln: hlint: Remove unless and $> warnings. 2021-08-27 06:13:56 -10:00
Stephen Morgan
beecb3c9ac cln: hlint: Clean up list related hlint warnings. 2021-08-27 06:13:56 -10:00
Stephen Morgan
22db5c4a3f cln: hlint: Remove warnings to use library list functions. 2021-08-27 06:13:56 -10:00
Stephen Morgan
330c21659f cln: hlint: Clean up Maybe related hlint warnings. 2021-08-27 06:13:56 -10:00
Stephen Morgan
e13239386f cln: hlint: Clean up == and elem related hlint warnings. 2021-08-27 06:13:56 -10:00
Stephen Morgan
3431b1b0d9 cln: hlint: Clean up map-fusion related hlint warnings. 2021-08-26 21:00:35 -10:00
Stephen Morgan
eb6047e81b cln: hlint: Remove redundant where and lambda warnings. 2021-08-26 21:00:35 -10:00
Stephen Morgan
71032c637e cln: hlint: Remove cons warnings. 2021-08-26 21:00:35 -10:00
Stephen Morgan
435fbf001e cln: hlint: Remove <|> and bimap warnings. 2021-08-26 21:00:35 -10:00
Stephen Morgan
46b0745412 cln: hlint: Remove Either and Bifunctor related warnings. 2021-08-26 21:00:35 -10:00
Stephen Morgan
69502c44fe cln: hlint: Fix record patterns warnings. 2021-08-26 21:00:35 -10:00
Stephen Morgan
1c211f8ab8 cln: hlint: Fix redundant return warning. 2021-08-26 21:00:35 -10:00
Simon Michael
8bf7cd30ae ;doc: update changelogs 2021-08-26 20:59:45 -10:00
Stephen Morgan
c07ad29a87 imp!: forecast: Implements more intuitive logic for the forecast interval. (#1648)
The forecast period begins on:
- the start date supplied to the `--forecast` argument, if present
- otherwise, the later of
  - the report start date if specified with -b/-p/date:
  - the day after the latest normal (non-periodic) transaction in the journal, if any
- otherwise today.
It ends on:
- the end date supplied to the `--forecast` argument, if present
- otherwise the report end date if specified with -e/-p/date:
- otherwise 180 days (6 months) from today.

Note that the previous behaviour did not quite match the documentation,
so this also acts as a bug fix for #1665.
2021-08-26 20:32:30 -10:00
Stephen Morgan
aa7a99a437 cln: hlint: Fix hlint warnings in Query.hs. 2021-08-26 07:23:11 -10:00
Stephen Morgan
d13ce0e134 cln: hlint: Remove Unused LANGUAGE pragma ignore. 2021-08-26 07:23:11 -10:00
Stephen Morgan
e666bbcaf0 cln: hlint: Fix newtype warning. 2021-08-26 07:23:11 -10:00
Stephen Morgan
1e69fd81ea cln: hlint: Remove if warnings. 2021-08-26 07:23:11 -10:00
Stephen Morgan
fed75c58e9 cln: hlint: Clean up hlint warnings not already ignored in hlint.yaml. 2021-08-25 20:44:36 -10:00
Stephen Morgan
063aaf35b5 cln: hlint: Rename pattern variables to avoid hlint parsing errors. 2021-08-25 20:44:36 -10:00
Simon Michael
bffeab45c8 ;doc: update changelogs 2021-08-24 05:14:24 -10:00
Simon Michael
53d9455bdc ;doc: update changelogs 2021-08-24 05:05:50 -10:00
Stephen Morgan
06312c353a fix!: register: Tighten up spacing around the date in register reports. (#1655)
As a side effect, this changes the Json representation of the
PostingsReport. The maybe report end date is now replaced with a maybe
period.
2021-08-22 08:15:22 -10:00
Simon Michael
e24b7ef90f fix: warning introduced by 993d0b5c 2021-08-22 06:58:08 -10:00
Stephen Morgan
34ab164b32 cln: Remove redundant bang patterns. 2021-08-21 17:50:21 -10:00
Stephen Morgan
912b5e6c23 cln: Derive more instances in Hledger.Data.Types to reduce orphans.
Also clean up some outdated or inaccurate comments.
2021-08-21 17:50:21 -10:00
Simon Michael
993d0b5c54 cli: --forecast now rejects instead of silently ignoring an interval
Something that confused me when testing #1632.
2021-08-20 17:55:59 -10:00
Lawrence
8a5addfb02 lib: implement periodic expressions for weekday et al
Implementation lifts DayOfWeek (renamed to DaysOfWeek) to a list of
days. This should match the previous behavior for single-element lists
2021-08-20 20:30:18 -05:00