Simon Michael
a2f6b30fbd
cln: silence some warnings/lints
2022-03-26 08:34:21 -10:00
Stephen Morgan
bffb6c8c82
ref: smartdate: Improve ergonomics of SmartDate constructors.
2022-03-25 19:10:58 -10:00
Simon Michael
929f13ec03
fix: warning ( #1799 )
2022-01-26 09:00:40 -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
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
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
35c33f342b
cln: Move column grouping functions form Report.PostingsReport to Data.Dates.
2021-09-18 14:40:28 -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
32dad455fd
cln: hlint: Clean up section 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
fed75c58e9
cln: hlint: Clean up hlint warnings not already ignored in hlint.yaml.
2021-08-25 20:44:36 -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
Stephen Morgan
e3ec01c3c6
lib,cli,ui: Use Text for showDate and related.
2021-01-02 15:08:09 +11:00
Simon Michael
a97daaf322
lib: replace pretty-show with pretty-simple
...
pretty-simple, already used in .ghci, will hopefully give nicer debug
output, including for values which don't have Read-able Show output.
This should mean that we can start removing custom string-like Show
instances that were a workaround for pretty-show.
We are using the latest version (4.0.0.0) to get compact output.
Here's some old pretty-show output:
CsvRules
{ rdirectives = [ ( "skip" , "1" ) ]
, rcsvfieldindexes = [ ( "date" , 1 ) , ( "amount" , 2 ) ]
, rassignments = [ ( "amount" , "%2" ) , ( "date" , "%1" ) ]
, rconditionalblocks = []
}
And the new pretty-simple output:
CsvRules
{ rdirectives=
[ ( "skip", "1" ) ]
, rcsvfieldindexes=
[ ( "date", 1 ), ( "amount", 2 ) ]
, rassignments=
[ ( "amount", "%2" ), ( "date", "%1" ) ]
, rconditionalblocks= []
}
Non-compact pretty-simple output would be:
CsvRules
{ rdirectives=
[
( "skip"
, "1B"
)
]
, rcsvfieldindexes=
[
( "date"
, 1
)
,
( "amount"
, 2
)
]
, rassignments=
[
( "amount"
, "%2"
)
,
( "date"
, "%1"
)
]
, rconditionalblocks=[]
}
Also:
- Account's Show instance no longer converts : to _ in account names
- drop unused pretty-show dependency from hledger, hledger-ui packages
- regenerate hledger-lib with the older hpack that's shipped in stack
2020-11-10 08:06:11 -08:00
Stephen Morgan
5a6d38fdf2
lib: For ymd date parsing, don't consume invalid date components.
2020-10-18 21:28:46 -07:00
Stephen Morgan
ca2e55c954
lib: Replace some fromIntegral with toInteger.
2020-08-30 22:20:58 +10:00
Stephen Morgan
371b349b2e
lib,cli: Replace parsedate and mkdatespan with direct applications of fromGregorian, transaction now takes Day instead of a date string.
2020-08-29 15:08:28 -07:00
Stephen Morgan
2fd678e415
lib,cli,ui: Remove old CPP directives made redundant by version bounds.
2020-08-29 15:08:28 -07:00
Stephen Morgan
f2dcbd2fee
lib: Make ill-formed SmartDates unrepresentable.
2020-08-07 14:20:08 -07:00
Simon Michael
3f55c23603
;review, tag all error calls with an easier to find PARTIAL: comment ( #1312 )
2020-08-05 16:08:33 -07:00
Stephen Morgan
08ad220448
lib: In quarterdatespanp, use yearp and allow uppercase Q.
2020-08-04 09:10:53 -07:00
Henning Thielemann
9c9701fe7d
lib: quarterdatespanp ( fixes #1247 )
2020-07-31 17:37:41 -07:00
Henning Thielemann
ccac09fb1b
lib: doubledatespanp: fix and re-enable doctest
2020-07-31 17:37:41 -07:00
Stephen Morgan
ffb5cf0773
lib: Ensure parsed years have at least 4 digits.
2020-07-31 17:22:27 -07:00
Stephen Morgan
7b9f9ae49c
lib: Refactor reportingintervalp to be more compact and do less backtracking.
2020-07-31 17:22:27 -07:00
Stephen Morgan
696d9c73b0
lib: Remove unnecessary try in parsers, replace unnecessary string' with string, rewrite some parsers in applicative style.
2020-07-31 17:22:27 -07:00
Stephen Morgan
081ee390ab
lib: Change skipMany spacenonewline to takeWhileP Nothing isNonNewlineSpace.
2020-07-22 14:58:53 -07:00
Simon Michael
4b9a76068f
lib: spanStartYear, spanEndYear, spanYears DateSpan helpers
2020-07-09 12:52:40 -07:00
Stephen Morgan
b3cd865786
lib: Add fortnightly as a synonym for biweekly.
2020-06-23 06:48:20 -07:00
Stephen Morgan
be25fe360e
lib: Parser now accepts .. as a synonym for to in date ranges.
2020-06-04 19:30:42 -07:00
Stephen Morgan
2f71da8838
lib: More consistent period formatting.
2020-06-04 19:30:42 -07:00
Simon Michael
10f8dc84a5
period expressions: allow "until", like Ledger (synonym for "to")
2020-04-08 14:26:38 -07:00
Stephen Morgan
702c958487
lib: Replace some utility functions with library functions.
2020-03-02 12:45:30 -08:00
Simon Michael
43c55bf4ea
;lib: add YYYY.MM.DD to parsedate/parsedateM helpers
...
For a bit more consistency with simple dates. And document better.
2020-02-27 10:57:55 -08:00
Jakob Schöttl
50acfc9119
Fix documentation, make ISO date format standard in some places
2020-02-09 07:26:54 -08:00
Simon Michael
e0a46a6523
;lib: update doctests for ISO 8601 date output
...
[ci skip]
2020-02-03 08:03:44 -08:00
Brian Wignall
35481a665b
Change Date output to yyyy-mm-dd
2020-01-07 15:58:22 -08:00
Stephen Morgan
38904372b2
Calculate MultiReportBalance columns more efficiently.
...
Only calculate posting date once for each posting, and calculate their
columns instead of checking each DateSpan separately.
2020-01-03 16:11:46 -08:00
Simon Michael
a0b92e02b9
Revert "remove old fail compatibility imports that are obsolete ?"
...
They are needed with ghc <8.4, not for fail but for <> I think.
Try cleaning up again another time.
This reverts commit 318ce7eb07 .
2019-12-01 11:32:51 -08:00
Simon Michael
318ce7eb07
remove old fail compatibility imports that are obsolete ?
2019-12-01 08:31:50 -08:00
Dmitry Astapov
cf4029a5ed
lib: fix generation of periodic transactions with days/months/... repeat
2019-09-11 16:09:28 -07:00
Simon Michael
499e20c0b2
lib, cli, ui: start using Control.Monad.Fail, allow base-compat 0.11
...
fail is moving out of Monad and into it's own MonadFail class.
This will be enforced in GHC 8.8 (I think).
base-compat/base-compat-batteries 0.11.0 have adapted to this,
and are approaching stackage nightly
(https://github.com/commercialhaskell/stackage/issues/4802 ).
hledger is now ready to build with base-compat-batteries 0.11.0, once
all of our deps do (eg aeson). We are still compatible with the older
0.10.x and GHC 7.10.3 as well.
For now we are using both fails:
- new fail (from Control.Monad.Fail), used in our parsers, imported
via base-compat-batteries Control.Monad.Fail.Compat to work with
older GHC versions.
- old fail (from GHC.Base, exported by Prelude, Control.Monad,
Control.Monad.State.Strict, Prelude.Compat, ...), used in easytest's
Test, since I couldn't find their existing fail implementation to update.
To reduce (my) confusion, these are imported carefully, consistently,
and qualified everywhere as Fail.fail and Prelude.fail, with clashing
re-exports suppressed, like so:
import Prelude hiding (fail)
import qualified Prelude (fail)
import Control.Monad.State.Strict hiding (fail)
import "base-compat-batteries" Prelude.Compat hiding (fail)
import qualified "base-compat-batteries" Control.Monad.Fail.Compat as Fail
2019-09-08 17:13:47 -07:00
Simon Michael
02ed4f5d04
;lib: intervalFromRawOpts: replace undefined with an error message
2019-07-25 10:46:45 +01:00
Caleb Maclennan
11d9e5eb6a
code: Strip extraneous trailing whitespace from Haskell sources
2019-07-15 16:40:49 +01:00
Simon Michael
bc7a1476ed
refactor: lib: hlint cleanups
2019-02-14 05:15:49 -08: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
Alex Chen
3d2584d869
lib: switch to megaparsec 7
2018-09-30 20:15:12 -06:00