Commit Graph

119 Commits

Author SHA1 Message Date
Mark Karpov
8d1f5cc35e Use better implementations for many and some by default 2024-09-28 21:20:40 +02:00
Jannis
6d07432bd6 Expand elem/notElem to allow fusion 2024-05-16 12:19:53 +02:00
Lev Dvorkin
53377ef1d1 Add initState and initPosState to Text.Megaparsec.State 2023-08-30 21:02:22 +02:00
Lev Dvorkin
15fb623b59 Preserve hints in MTL instances
Extend the `Ok` data constructor of `Result` to include hints in order to
avoid losing information due to invoking `runParsecT` followed by `mkPT`.
2023-06-06 20:01:08 +02:00
Mark Karpov
3496aaa34f Point out that 'parse' and 'runParser' are the same 2023-03-23 18:52:34 +01:00
dependabot[bot]
69d4c46e36 Bump mrkkrp/ormolu-action from 9 to 10
Bumps [mrkkrp/ormolu-action](https://github.com/mrkkrp/ormolu-action) from 9 to 10.
- [Release notes](https://github.com/mrkkrp/ormolu-action/releases)
- [Changelog](https://github.com/mrkkrp/ormolu-action/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mrkkrp/ormolu-action/compare/v9...v10)

---
updated-dependencies:
- dependency-name: mrkkrp/ormolu-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-13 11:35:23 +01:00
Mark Karpov
889c9f3446
Fix a typo 2022-10-21 20:26:14 +02:00
Mark Karpov
ed6fdf71d9 Improve the writing 2021-04-25 16:03:52 +02:00
Mark Karpov
040a1be79e
Add a performance note to the dos of ‘satisfy’
Close #434.
2020-12-14 12:08:57 +01:00
mlugg
ccf314b0b9 Add Safe Haskell support
Remove dependence on GeneralizedNewtypeDeriving and add Safe Haskell
extensions to every file.
2020-10-17 18:53:15 +02:00
1computer1
34b34c3d93 Decouple the error reporting-related methods from ‘Stream’
Split the ‘Stream’ type class. The methods ‘showTokens’ and ‘tokensLength’
have been put into a separate type class ‘VisualStream’, while ‘reachOffset’
and ‘reachOffsetNoLine’ are now in ‘TraversableStream’. This should make
defining ‘Stream’ instances for custom streams easier.

Defined ‘Stream’ instances for lists and ‘Seq’s.
2020-09-02 19:50:45 +02:00
Mark Karpov
99e640ec39
Format the source code with Ormolu 2020-04-23 22:05:36 +02:00
mrkkrp
20811826ca
Update the links to the tutorial 2019-11-22 23:16:51 +01:00
mrkkrp
31b917b129 Allow registration of delayed parse errors
Megaparsec now supports registration of “delayed” parse errors. On lower
level we added a new field called ‘stateParseErrors’ to the ‘State’ record.
The type also had to change from ‘State s’ to ‘State s e’. This field
contains the list of registered ‘ParseErrors’ that do not end parsing
immediately but still will cause failure in the end if the list is not
empty. Users are expected to register parse errors using the three
functions: ‘registerParseError’, ‘registerFailure’, and
‘registerFancyFailure’. These functions are analogous to those without the
‘register’ prefix, except that they have “delayed” effect.
2019-11-07 12:48:56 +01:00
mrkkrp
f8ef95c025 Re-organize error reporting functions
The methods ‘failure’ and ‘fancyFailure’ of ‘MonadParsec’ are now ordinary
functions and live in ‘Text.Megaparsec’. They are defined in terms of the
new ‘parseError’ method of ‘MonadParsec’. This method allows us to signal
parse errors at a given offset without manipulating parser state manually.
2019-11-05 14:18:55 +01:00
mrkkrp
87d425759a Simplify type signatures of ‘reachOffset’ and ‘reachOffsetNoLine’
Changed type signatures of ‘reachOffset’ and ‘reachOffsetNoLine’ methods of
the ‘Stream’ type class. Instead of three-tuple ‘reachOffset’ now returns
two-tuple because ‘SourcePos’ is already contained in the returned
‘PosState’ record.
2019-07-13 17:37:46 +02:00
mrkkrp
de4fddad7a
Use the word “present” instead of current year in copyright notes
[skip ci]
2019-07-02 21:41:24 +02:00
mrkkrp
b83f1b1e34
Update copyright years
[skip ci]
2019-01-01 12:50:48 +07:00
mrkkrp
b200b09830
Numerous documentation corrections 2018-11-07 12:21:00 +07:00
mrkkrp
e556853725
Drop ‘liftM’ 2018-10-26 20:07:46 +07:00
mrkkrp
b0335b6946
Misc improvements in the docs 2018-09-05 02:24:28 +07:00
Mark Karpov
e3072661ad
Optimize ‘reachOffset’, introduce ‘reachOffsetNoLine’ (#318)
Fetching line makes for a major slow-down, we cannot afford this.
2018-08-31 22:20:35 +07:00
Mark Karpov
573bacf721
Use offset in parse errors (#313)
The change allows to speed-up parsers in most cases and re-use the fact that
we're traversing input stream on pretty-printing ‘ParseError’s anyway.
2018-08-20 23:35:10 +07:00
Mark Karpov
4ea6a01896
Introduce parse error bundle (#306)
* Introduce parse error bundle

* Update the changelog (parse error bundle)
2018-07-15 20:01:35 +07:00
mrkkrp
3d4c22a71c
Inline more 2018-05-01 14:23:52 +07:00
mrkkrp
a2175ea6db
Apply hlint recommendations 2018-04-30 21:32:58 +07:00
mrkkrp
7120bae9b2
Drop stacks of source positions 2018-04-20 19:24:05 +07:00
mrkkrp
cdbbe5c3d0
Move ‘dbg’ into a separate module 2018-04-20 14:20:43 +07:00
mrkkrp
2d175cd706
Drop support for GHC 7.8 2018-04-20 13:07:16 +07:00
mrkkrp
370f869d64 Add a note about monadic vs applicative combinators 2018-03-27 22:21:31 +07:00
Mark Karpov
e3ce90bd73 Add ‘Text.Megaparsec.Internal’ (#288) 2018-03-27 22:02:24 +07:00
Mark Karpov
fd7f214e54
Enable more warnings (#285) 2018-03-21 17:25:26 +07:00
Mark Karpov
adce847803 Fix backtracking of exponent and fractional parts in numeric helpers (#279)
‘scientific’ now correctly backtracks after attempting to parse fractional
and exponent parts of a number. ‘float’ correctly backtracks after
attempting to parse optional exponent part (when it comes after fractional
part, otherwise it's obligatory).
2018-03-04 20:34:48 +07:00
Mark Karpov
4fac009b48
Move general-enough combinators to ‘Text.Megaparsec’ (#267) 2018-01-08 22:39:39 +07:00
mrkkrp
cb762351d0 Include 2018 into the copyright years range
[skip ci]
2018-01-01 14:04:07 +07:00
mrkkrp
966768acbe Promote ‘Control.Monad.Combinators.NonEmpty’ in the docs
[skip ci]
2017-12-31 16:05:56 +07:00
Mark Karpov
c776fc16fb Use parser combinators 0.4.0 (#269) 2017-12-31 16:02:03 +07:00
Mark Karpov
d3e29619cc
Simplify the type of the ‘token’ primitive (#266) 2017-12-17 22:03:03 +07:00
Mark Karpov
aee96cd519
Make ‘atEnd’ not produce hints (#264) 2017-12-17 13:03:56 +07:00
mrkkrp
3c0d961a7d Add ‘since’ notes to some instance declarations 2017-12-14 12:06:20 +07:00
mrkkrp
9ef762fef8 Minor corrections and a test for the last PR 2017-12-14 11:35:36 +07:00
Vladislav Zavialov
58ab67759f Add the 'customFailure' combinator (#260) 2017-12-14 11:20:04 +07:00
Vladislav Zavialov
576c29aefd Add an IsString instance and tests for it (#259) 2017-12-13 22:14:22 +07:00
mrkkrp
a69f955f75 Adjust documentation for the ‘Hints’ type 2017-12-09 11:40:34 +07:00
Mark Karpov
b99174d7f1 Make ‘sconcat’ more efficient on ‘ParsecT’ (#253)
* Make ‘sconcat’ more efficient on ‘ParsecT’

* Do the same thing for ‘mconcat’
2017-10-15 16:26:28 +07:00
mrkkrp
10c3d7b6cf Update per-argument docs of ‘tokens’
[skip ci]
2017-08-26 20:57:05 +07:00
Mark Karpov
e2abc9ee5d Use ‘eok’ continuation in ‘tokens’ when matching empty chunk (#246) 2017-08-14 17:46:59 +07:00
Mark Karpov
aac10c8bee Add hint erasing when try backtracks consuming (#243) 2017-08-08 16:36:47 +07:00
Profpatsch
c8ed8d0112 Clarify the difference between ‘pure’ and ‘empty’ 2017-08-08 15:05:38 +07:00
mrkkrp
390560f177 Add a note about ‘Control.Applicative.Combinators.NonEmpty’ 2017-07-30 23:14:08 +07:00