packages feed

headed-megaparsec 0.2.1.1 → 0.2.1.2

raw patch · 4 files changed

+8/−33 lines, 4 filesdep ~basedep ~selectivePVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: base, selective

API changes (from Hackage documentation)

- HeadedMegaparsec: dbg :: (Ord err, ShowErrorComponent err, VisualStream strm, Show a) => String -> HeadedParsec err strm a -> HeadedParsec err strm a
+ HeadedMegaparsec: dbg :: (ShowErrorComponent err, VisualStream strm, Show a) => String -> HeadedParsec err strm a -> HeadedParsec err strm a
- HeadedMegaparsec: filter :: (Ord err, Stream strm) => (a -> String) -> (a -> Bool) -> HeadedParsec err strm a -> HeadedParsec err strm a
+ HeadedMegaparsec: filter :: Stream strm => (a -> String) -> (a -> Bool) -> HeadedParsec err strm a -> HeadedParsec err strm a
- HeadedMegaparsec: parse :: (Ord err, Stream strm) => Parsec err strm a -> HeadedParsec err strm a
+ HeadedMegaparsec: parse :: Parsec err strm a -> HeadedParsec err strm a

Files

headed-megaparsec.cabal view
@@ -1,5 +1,5 @@ name: headed-megaparsec-version: 0.2.1.1+version: 0.2.1.2 category: Parsers, Parsing, Megaparsec synopsis: More informative parser homepage: https://github.com/nikita-volkov/headed-megaparsec@@ -26,8 +26,8 @@     HeadedMegaparsec.Megaparsec     HeadedMegaparsec.Prelude   build-depends:-    base >=4.12 && <5,+    base >=4.13 && <5,     case-insensitive >=1.2 && <2,     megaparsec >=9.2 && <10,     parser-combinators >=1.3 && <1.4,-    selective >=0.5 && <0.7+    selective >=0.7 && <0.8
library/HeadedMegaparsec.hs view
@@ -23,8 +23,6 @@ import HeadedMegaparsec.Prelude hiding (filter, head, tail, try) import Text.Megaparsec (Parsec, Stream) import qualified Text.Megaparsec as Megaparsec-import qualified Text.Megaparsec.Char as MegaparsecChar-import qualified Text.Megaparsec.Char.Lexer as MegaparsecLexer import qualified Text.Megaparsec.Debug as Megaparsec  -- $setup@@ -218,7 +216,7 @@ -- -- This function is a wrapper around `Megaparsec.dbg`. -- It generates two debugging entries: one for head and one for tail.-dbg :: (Ord err, Megaparsec.ShowErrorComponent err, Megaparsec.VisualStream strm, Show a) => String -> HeadedParsec err strm a -> HeadedParsec err strm a+dbg :: (Megaparsec.ShowErrorComponent err, Megaparsec.VisualStream strm, Show a) => String -> HeadedParsec err strm a -> HeadedParsec err strm a dbg label = mapParsec $ \p -> do   Showable _ junction <- Megaparsec.dbg (label <> "/head") (fmap (either (\a -> Showable (show a) (Left a)) (Showable "<tail parser>" . Right)) p)   case junction of@@ -228,7 +226,7 @@ -- | -- Filter the results of parser based on a predicate, -- failing with a parameterized message.-filter :: (Ord err, Stream strm) => (a -> String) -> (a -> Bool) -> HeadedParsec err strm a -> HeadedParsec err strm a+filter :: (Stream strm) => (a -> String) -> (a -> Bool) -> HeadedParsec err strm a -> HeadedParsec err strm a filter err pred = mapParsec $ \p -> do   junction <- p   case junction of@@ -245,31 +243,12 @@  -- | -- Lift a megaparsec parser as a head parser.-head :: (Ord err, Stream strm) => Parsec err strm a -> HeadedParsec err strm a+head :: Parsec err strm a -> HeadedParsec err strm a head = HeadedParsec . fmap Left  -- |--- Lift a megaparsec parser as a tail parser.------ Composing consecutive tails results in one tail.------ Composing consecutive head and tail leaves the head still composable with preceding head.-tail :: (Stream strm) => Parsec err strm a -> HeadedParsec err strm a-tail = HeadedParsec . return . Right---- |--- Lift both head and tail megaparsec parsers, composing their results.-headAndTail :: (Ord err, Stream strm) => (head -> tail -> a) -> Parsec err strm head -> Parsec err strm tail -> HeadedParsec err strm a-headAndTail fn headP tailP = HeadedParsec $ do-  a <- headP-  return $-    Right $ do-      b <- tailP-      return (fn a b)---- | -- Lift a megaparsec parser.-parse :: (Ord err, Stream strm) => Parsec err strm a -> HeadedParsec err strm a+parse :: Parsec err strm a -> HeadedParsec err strm a parse = head  -- * Control
library/HeadedMegaparsec/Megaparsec.hs view
@@ -2,11 +2,8 @@ -- Extra megaparsec combinators. module HeadedMegaparsec.Megaparsec where -import Control.Applicative.Combinators-import HeadedMegaparsec.Prelude hiding (body, head, try)+import HeadedMegaparsec.Prelude hiding (head, try) import Text.Megaparsec hiding (endBy1, sepBy1, sepEndBy1, some, someTill)-import Text.Megaparsec.Char-import qualified Text.Megaparsec.Char.Lexer as Lexer  contPossibly :: (Ord err, Stream strm) => Parsec err strm (Either a (Parsec err strm a)) -> Parsec err strm a contPossibly p = do
library/HeadedMegaparsec/Prelude.hs view
@@ -66,7 +66,6 @@ import System.Mem as Exports import System.Mem.StableName as Exports import System.Timeout as Exports-import Text.ParserCombinators.ReadP as Exports (ReadP, ReadS, readP_to_S, readS_to_P) import Text.ParserCombinators.ReadPrec as Exports (ReadPrec, readP_to_Prec, readPrec_to_P, readPrec_to_S, readS_to_Prec) import Text.Printf as Exports (hPrintf, printf) import Text.Read as Exports (Read (..), readEither, readMaybe)