Commit Graph

1340 Commits

Author SHA1 Message Date
trevorriles
9b1343d0b9 Add fast flag to doctests.
Fixes #802
2018-06-07 10:41:09 -05:00
Simon Michael
061aad0431 remove some CPP that's obsolete since we require base 4.8+ 2018-06-04 17:33:21 -07:00
Simon Michael
7ebecb1ab8 use newer hashtables to fix an instance warning with doctests/ghc 7 (#794) 2018-06-04 17:33:17 -07:00
Simon Michael
0ce9c5728a switch to base-compat-batteries to fix ghc 7.10 support (#794)
base-compat-batteries provides the same API across more ghc versions
than base-compat does, at the cost of more dependencies. Eg it exports
Prelude.Compat ((<>)) with ghc 7.10/base 4.8, which we expect.
My belief is that several of our deps already require it so the added
cost is not too great. We should probably go back to base-compat when
possible though, eg when we stop supporting ghc 7.10.
2018-06-04 17:32:42 -07:00
Simon Michael
328b2dabfe require latest base-compat, might as well (#794) 2018-06-04 17:32:32 -07:00
Peter Simons
6db7f800ee hledger-lib: fix doctest suite after recent package updates
The new version of our package set apparently contains both base-compat and
base-compat-batteries in its transitive closure. This breaks the doctest suite,
which just imports everything into scope when the tests are run, thereby making
module names like Prelude.Compat ambiguous.
2018-06-04 21:41:15 +02:00
Peter Simons
8c0c168cd6 Fix the build of hledger-lib with ghc 8.0.x and base-compat 0.10.x.
We don't need to import Data.Monoid because Prelude.Compat exports "<>"
already. In fact, importing that module causes build failures:

    Hledger/Read/Common.hs:725:62: error:
        Ambiguous occurrence ‘<>’
        It could refer to either ‘Sem.<>’,
                                 imported from ‘Prelude.Compat’ at Hledger/Read/Common.hs:97:1-39
                                 (and originally defined in ‘Data.Semigroup’)
                              or ‘Data.Monoid.<>’,
                                 imported from ‘Data.Monoid’ at Hledger/Read/Common.hs:110:1-18

Fixes https://github.com/simonmichael/hledger/issues/794.
2018-06-04 20:58:58 +02:00
Simon Michael
66fbdc5d61 lib: enable doctests on mac again, note workaround, fix link
[ci skip]
2018-06-01 07:18:12 -07:00
Alex Chen
1116261f5a lib: simplify fromRawNumber 2018-05-27 07:50:26 -07:00
Alex Chen
c3f5659d75 lib: add some strictness annotations to the parser
This was done to reverse minor performance regressions introduced in the
previous commits
2018-05-27 07:50:26 -07:00
Alex Chen
d79e707485 lib: remove redundant check in accountnamep 2018-05-27 07:50:26 -07:00
Alex Chen
43aa3d479e lib: fix up runJournalParser 2018-05-27 07:50:26 -07:00
Alex Chen
d56fca1ba2 lib: superficial parser cleanups 2018-05-27 07:50:26 -07:00
Alex Chen
2a492696a9 lib: prevent the parsing of prices of prices 2018-05-27 07:50:26 -07:00
Alex Chen
edf9cc2366 lib: move handling of exponentials into fromRawNumber [API]
- Rationale:
  - The information necessary for applying exponents to a number is more
    explicitly represented in the inputs to `fromRawNumber` than in the outputs
  - This way, `exponentp` may simply return an `Int`
2018-05-27 07:50:26 -07:00
Alex Chen
f7fd6e6525 lib: refactor the raw number parser [API]
- Purpose: to reduce the verbosity of the previous implementation
- Split off `AmbiguousNumber` into its own type
- Introduce a function `AmbiguousNumber -> RawNumber` explicitly capturing the
  disambiguation logic
- Reduce the number of remaining constructors in `RawNumber` to just two,
  `WithSeparator` and `NoSeparator`
  - The choice to distinguish by the presence of digit separators is motivated
    by the need for this information later on when disallowing exponents on
    numbers with digit separators
2018-05-27 07:50:26 -07:00
Alex Chen
6ffa9cb3cd lib: rename pdigitgroup to digitgroupp for consistency 2018-05-27 07:50:26 -07:00
Alex Chen
cf9b2001e7 lib: refactor sign parser
- Extracts the handling of signs out of `fromRawNumber` and into `signp` itself
- Rationale: The sign can be applied independently from the logic in
  `fromRawNumber`
2018-05-27 07:50:26 -07:00
Alex Chen
84c7e2c403 lib: superficial changes to parsers 2018-05-24 09:35:27 -07:00
Alex Chen
121ba92ade lib: refactor the raw number parser [API change] 2018-05-24 09:35:27 -07:00
Alex Chen
93fbac99d3 lib: refactor date parser 2018-05-24 09:35:27 -07:00
Alex Chen
12e8d0e282 lib: change some parsers to use takeWhileP 2018-05-22 12:16:46 -07:00
Alex Chen
558c11596f lib: refactor the account name parser 2018-05-22 12:16:46 -07:00
Alex Chen
b245ec7b3d lib: remove the megaparsec compatability module 2018-05-22 12:16:46 -07:00
Alex Chen
c4ba7542d7 lib: use megaparsec 6 for all supported ghc versions 2018-05-22 12:16:46 -07:00
Alex Chen
676ea912b3 lib: fix issue where spaces were allowed as decimal points
- Fixes #749
- Also enabling the tests prepared for #749
2018-05-20 20:17:57 -07:00
awjchen
46aae19a54
lib: fix parsing of amounts with a whitespace digits separator 2018-05-20 16:02:59 -06:00
Simon Michael
581d02162c resolve all current build warnings with the supported GHC versions
If I'm lucky.
2018-05-17 20:43:55 -07:00
Alex Chen
67ed2d6cbf lib: superficial changes to comment parsers 2018-05-17 18:15:06 -07:00
Alex Chen
188583e232 lib: cleanup: remove redundant comment parsing alternatives 2018-05-17 18:15:06 -07:00
Alex Chen
892a1c6434 lib: refactor: make the bracketed date tags parser a SimpleTextParser 2018-05-17 18:15:06 -07:00
Alex Chen
0cff1634be lib: refactor: make the bracketed datetags parser a SimpleTextParser in all but type 2018-05-17 18:15:06 -07:00
Alex Chen
b3a91a49d8 lib: refactor: factor out a TextParser from datep 2018-05-17 18:15:06 -07:00
Alex Chen
09fd8132b7 lib: refactor: weaken types of comment parsers 2018-05-17 18:15:06 -07:00
Simon Michael
1c6702d598 budget: note some todos
[ci skip]
2018-05-17 08:12:14 -07:00
Alex Chen
31b72f0415 lib: replace notChar for backwards compatibility with megaparsec 5 2018-05-16 22:35:22 -07:00
Alex Chen
99e457f1da lib: fix performance regression introduced in 30ae9914 2018-05-15 19:29:59 -07:00
Alex Chen
12ddcb1784 lib: extend export list of Read/Common.hs 2018-05-15 11:52:29 -07:00
Alex Chen
17b11aaf1e lib: refactor parsing of bracketed posting dates 2018-05-15 11:52:29 -07:00
Alex Chen
fcc10f018d lib: merge parsing of date-tags with that of tags 2018-05-15 11:52:29 -07:00
Alex Chen
ec85271a0b lib: refactor tags parser: be more efficient, save SourcePos for later 2018-05-15 11:52:29 -07:00
Stephen Morgan
6c2385331c Allow comments for periodic transactions. 2018-05-14 18:28:27 -07:00
Simon Michael
c9d46f830f lib: fix hpack warning
[ci skip]
2018-05-14 10:28:29 -07:00
Mykola Orliuk
64c7eb78f4 GHC 8.0 compatibility 2018-05-13 14:41:08 -07:00
Stephen Morgan
5bc5bb5533 Fix doctest error introduced by 49c8c093ac. 2018-05-11 07:25:17 -07:00
Simon Michael
7040289d54 add some exports to fix warnings (#762) 2018-05-11 07:17:38 -07:00
Alex Chen
3aa72bdf16 lib: Clean up new code introduced for #655 2018-05-11 06:41:13 -07:00
Alex Chen
30ae991484 lib: Strip comment before parsing tags (#655) 2018-05-11 06:41:13 -07:00
Alex Chen
09ec6041bd lib: Report source positions from internal comment parsers 2018-05-11 06:41:13 -07:00
Alex Chen
b06d22a418 lib: Refactor common comment parsers 2018-05-11 06:41:13 -07:00