parsley 1.0.1.0 → 1.0.2.0
raw patch · 3 files changed
+38/−2 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Parsley.Register: localModify :: Reg r a -> Parser (a -> a) -> Parser b -> Parser b
+ Parsley.Register: localModify_ :: ParserOps rep => Reg r a -> rep (a -> a) -> Parser b -> Parser b
+ Parsley.Register: local_ :: ParserOps rep => Reg r a -> rep a -> Parser b -> Parser b
Files
- ChangeLog.md +5/−0
- parsley.cabal +1/−1
- src/ghc/Parsley/Register.hs +32/−1
ChangeLog.md view
@@ -37,3 +37,8 @@ * Added `line` and `col` combinators. * Added `pos` combinator.++## 1.0.2.0 -- 2021-11-14++* Added `local_` combinator to `Register`.+* Added `localModify` and `localModify_` combinators to `Register`.
parsley.cabal view
@@ -5,7 +5,7 @@ -- | +------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change-version: 1.0.1.0+version: 1.0.2.0 synopsis: A fast parser combinator library backed by Typed Template Haskell description: Parsley is a staged selective parser combinator library, which means it does not support monadic operations, and relies on Typed Template
src/ghc/Parsley/Register.hs view
@@ -21,7 +21,9 @@ gets, gets_, modify, modify_, move, swap,- bind, local, rollback,+ local, local_,+ localModify, localModify_,+ bind, rollback, for ) where @@ -151,6 +153,35 @@ local r p q = bind (get r) $ \x -> put r p *> q <* put r x++{-|+@local_ reg x p@ stores @x@ in @reg@ for the /duration/ of parsing @p@.+If @p@ succeeds, @reg@ will be restored to its original state.++@since 1.0.2.0+-}+local_ :: ParserOps rep => Reg r a -> rep a -> Parser b -> Parser b+local_ r = local r . pure++{-|+@localModify reg p q@ first parses @p@ and @reg@ with its returned function for the /duration/ of parsing @q@.+If @q@ succeeds, @reg@ will be restored to its original state /before/ @p@ was parsed.++@since 1.0.2.0+-}+localModify :: Reg r a -> Parser (a -> a) -> Parser b -> Parser b+localModify r p q = bind (get r) $ \x -> modify r p+ *> q+ <* put r x++{-|+@localModify_ reg x p@ modifes @reg@ using @f@ for the /duration/ of parsing @p@.+If @p@ succeeds, @reg@ will be restored to its original state.++@since 1.0.2.0+-}+localModify_ :: ParserOps rep => Reg r a -> rep (a -> a) -> Parser b -> Parser b+localModify_ r = localModify r . pure {-| This combinator will swap the values contained in two registers.