@@ -219,7 +219,7 @@ import qualified Streamly.Internal.Data.Parser.ParserK.Types as K
220{-# INLINE fromFold #-}
220{-# INLINE fromFold #-}
221fromFold :: MonadCatch m => Fold m a b -> Parser m a b
221fromFold :: MonadCatch m => Fold m a b -> Parser m a b
222−fromFold = D.toParserK . D.fromFold
222+fromFold = K.toParserK . D.fromFold
224-------------------------------------------------------------------------------
224-------------------------------------------------------------------------------
225-- Terminating but not failing folds
225-- Terminating but not failing folds
@@ -231,7 +231,7 @@ fromFold = D.toParserK . D.fromFold
232{-# INLINE any #-}
232{-# INLINE any #-}
233any :: MonadCatch m => (a -> Bool) -> Parser m a Bool
233any :: MonadCatch m => (a -> Bool) -> Parser m a Bool
234−any = D.toParserK . D.any
234+any = K.toParserK . D.any
237-- >>> S.parse (PR.all (== 0)) $ S.fromList [1,0,1]
237-- >>> S.parse (PR.all (== 0)) $ S.fromList [1,0,1]
@@ -239,7 +239,7 @@ any = D.toParserK . D.any
240{-# INLINE all #-}
240{-# INLINE all #-}
241all :: MonadCatch m => (a -> Bool) -> Parser m a Bool
241all :: MonadCatch m => (a -> Bool) -> Parser m a Bool
242−all = D.toParserK . D.all
242+all = K.toParserK . D.all
244-- This is the dual of stream "yield".
244-- This is the dual of stream "yield".
@@ -249,9 +249,9 @@ all = D.toParserK . D.all
250{-# INLINE [3] yield #-}
250{-# INLINE [3] yield #-}
251yield :: MonadCatch m => b -> Parser m a b
251yield :: MonadCatch m => b -> Parser m a b
252−yield = D.toParserK . D.yield
252+yield = K.toParserK . D.yield
253{-# RULES "yield fallback to CPS" [2]
253{-# RULES "yield fallback to CPS" [2]
254− forall a. D.toParserK (D.yield a) = K.yield a #-}
254+ forall a. K.toParserK (D.yield a) = K.yield a #-}
256-- This is the dual of stream "yieldM".
256-- This is the dual of stream "yieldM".
@@ -262,7 +262,7 @@ yield = D.toParserK . D.yield
263{-# INLINE yieldM #-}
263{-# INLINE yieldM #-}
264yieldM :: MonadCatch m => m b -> Parser m a b
264yieldM :: MonadCatch m => m b -> Parser m a b
265−yieldM = D.toParserK . D.yieldM
265+yieldM = K.toParserK . D.yieldM
267-- This is the dual of "nil".
267-- This is the dual of "nil".
@@ -273,9 +273,9 @@ yieldM = D.toParserK . D.yieldM
274{-# INLINE [3] die #-}
274{-# INLINE [3] die #-}
275die :: MonadCatch m => String -> Parser m a b
275die :: MonadCatch m => String -> Parser m a b
276−die = D.toParserK . D.die
276+die = K.toParserK . D.die
277{-# RULES "die fallback to CPS" [2]
277{-# RULES "die fallback to CPS" [2]
278− forall a. D.toParserK (D.die a) = K.die a #-}
278+ forall a. K.toParserK (D.die a) = K.die a #-}
280-- This is the dual of "nilM".
280-- This is the dual of "nilM".
@@ -286,7 +286,7 @@ die = D.toParserK . D.die
287{-# INLINE dieM #-}
287{-# INLINE dieM #-}
288dieM :: MonadCatch m => m String -> Parser m a b
288dieM :: MonadCatch m => m String -> Parser m a b
289−dieM = D.toParserK . D.dieM
289+dieM = K.toParserK . D.dieM
291-------------------------------------------------------------------------------
291-------------------------------------------------------------------------------
292-- Failing Parsers
292-- Failing Parsers
@@ -306,7 +306,7 @@ dieM = D.toParserK . D.dieM
307{-# INLINE peek #-}
307{-# INLINE peek #-}
308peek :: MonadCatch m => Parser m a a
308peek :: MonadCatch m => Parser m a a
309−peek = D.toParserK D.peek
309+peek = K.toParserK D.peek
311-- | Succeeds if we are at the end of input, fails otherwise.
311-- | Succeeds if we are at the end of input, fails otherwise.
@@ -317,7 +317,7 @@ peek = D.toParserK D.peek
318{-# INLINE eof #-}
318{-# INLINE eof #-}
319eof :: MonadCatch m => Parser m a ()
319eof :: MonadCatch m => Parser m a ()
320−eof = D.toParserK D.eof
320+eof = K.toParserK D.eof
322-- | Returns the next element if it passes the predicate, fails otherwise.
322-- | Returns the next element if it passes the predicate, fails otherwise.
@@ -328,7 +328,7 @@ eof = D.toParserK D.eof
329{-# INLINE satisfy #-}
329{-# INLINE satisfy #-}
330satisfy :: MonadCatch m => (a -> Bool) -> Parser m a a
330satisfy :: MonadCatch m => (a -> Bool) -> Parser m a a
331−satisfy = D.toParserK . D.satisfy
331+satisfy = K.toParserK . D.satisfy
333-------------------------------------------------------------------------------
333-------------------------------------------------------------------------------
334-- Taking elements
334-- Taking elements
@@ -355,7 +355,7 @@ satisfy = D.toParserK . D.satisfy
355{-# INLINE takeBetween #-}
355{-# INLINE takeBetween #-}
356takeBetween :: -- MonadCatch m =>
356takeBetween :: -- MonadCatch m =>
357 Int -> Int -> Fold m a b -> Parser m a b
357 Int -> Int -> Fold m a b -> Parser m a b
358−takeBetween _m _n = undefined -- D.toParserK . D.takeBetween m n
358+takeBetween _m _n = undefined -- K.toParserK . D.takeBetween m n
@@ -384,7 +384,7 @@ takeBetween _m _n = undefined -- D.toParserK . D.takeBetween m n
385{-# INLINE take #-}
385{-# INLINE take #-}
386take :: MonadCatch m => Int -> Fold m a b -> Parser m a b
386take :: MonadCatch m => Int -> Fold m a b -> Parser m a b
387−take n = D.toParserK . D.take n
387+take n = K.toParserK . D.take n
389-- | Stops after taking exactly @n@ input elements.
389-- | Stops after taking exactly @n@ input elements.
@@ -398,7 +398,7 @@ take n = D.toParserK . D.take n
399{-# INLINE takeEQ #-}
399{-# INLINE takeEQ #-}
400takeEQ :: MonadCatch m => Int -> Fold m a b -> Parser m a b
400takeEQ :: MonadCatch m => Int -> Fold m a b -> Parser m a b
401−takeEQ n = D.toParserK . D.takeEQ n
401+takeEQ n = K.toParserK . D.takeEQ n
403-- | Take at least @n@ input elements, but can collect more.
403-- | Take at least @n@ input elements, but can collect more.
@@ -415,7 +415,7 @@ takeEQ n = D.toParserK . D.takeEQ n
416{-# INLINE takeGE #-}
416{-# INLINE takeGE #-}
417takeGE :: MonadCatch m => Int -> Fold m a b -> Parser m a b
417takeGE :: MonadCatch m => Int -> Fold m a b -> Parser m a b
418−takeGE n = D.toParserK . D.takeGE n
418+takeGE n = K.toParserK . D.takeGE n
420-- $takeWhile
420-- $takeWhile
421-- Note: This is called @takeWhileP@ and @munch@ in some parser libraries.
421-- Note: This is called @takeWhileP@ and @munch@ in some parser libraries.
@@ -439,7 +439,7 @@ takeGE n = D.toParserK . D.takeGE n
439{-# INLINE takeWhileP #-}
439{-# INLINE takeWhileP #-}
440takeWhileP :: -- MonadCatch m =>
440takeWhileP :: -- MonadCatch m =>
441 (a -> Bool) -> Parser m a b -> Parser m a b
441 (a -> Bool) -> Parser m a b -> Parser m a b
442−takeWhileP _cond = undefined -- D.toParserK . D.takeWhileP cond
442+takeWhileP _cond = undefined -- K.toParserK . D.takeWhileP cond
444-- | Collect stream elements until an element fails the predicate. The element
444-- | Collect stream elements until an element fails the predicate. The element
445-- on which the predicate fails is returned back to the input stream.
445-- on which the predicate fails is returned back to the input stream.
@@ -460,7 +460,7 @@ takeWhileP _cond = undefined -- D.toParserK . D.takeWhileP cond
461{-# INLINE takeWhile #-}
461{-# INLINE takeWhile #-}
462takeWhile :: MonadCatch m => (a -> Bool) -> Fold m a b -> Parser m a b
462takeWhile :: MonadCatch m => (a -> Bool) -> Fold m a b -> Parser m a b
463−takeWhile cond = D.toParserK . D.takeWhile cond
463+takeWhile cond = K.toParserK . D.takeWhile cond
465-- | Like 'takeWhile' but takes at least one element otherwise fails.
465-- | Like 'takeWhile' but takes at least one element otherwise fails.
@@ -468,7 +468,7 @@ takeWhile cond = D.toParserK . D.takeWhile cond
469{-# INLINE takeWhile1 #-}
469{-# INLINE takeWhile1 #-}
470takeWhile1 :: MonadCatch m => (a -> Bool) -> Fold m a b -> Parser m a b
470takeWhile1 :: MonadCatch m => (a -> Bool) -> Fold m a b -> Parser m a b
471−takeWhile1 cond = D.toParserK . D.takeWhile1 cond
471+takeWhile1 cond = K.toParserK . D.takeWhile1 cond
473-- | Like 'sliceSepBy' but uses a 'Parser' instead of a 'Fold' to collect the
473-- | Like 'sliceSepBy' but uses a 'Parser' instead of a 'Fold' to collect the
474-- input. @sliceSepByP cond parser@ parses a slice of the input using @parser@
474-- input. @sliceSepByP cond parser@ parses a slice of the input using @parser@
@@ -487,7 +487,7 @@ takeWhile1 cond = D.toParserK . D.takeWhile1 cond
487{-# INLINABLE sliceSepByP #-}
487{-# INLINABLE sliceSepByP #-}
488sliceSepByP :: -- MonadCatch m =>
488sliceSepByP :: -- MonadCatch m =>
489 (a -> Bool) -> Parser m a b -> Parser m a b
489 (a -> Bool) -> Parser m a b -> Parser m a b
490−sliceSepByP _cond = undefined -- D.toParserK . D.sliceSepByP cond
490+sliceSepByP _cond = undefined -- K.toParserK . D.sliceSepByP cond
492-- Note: Keep this consistent with S.splitOn. In fact we should eliminate
492-- Note: Keep this consistent with S.splitOn. In fact we should eliminate
493-- S.splitOn in favor of the parser.
493-- S.splitOn in favor of the parser.
@@ -536,7 +536,7 @@ sliceSepByP _cond = undefined -- D.toParserK . D.sliceSepByP cond
536-- /Internal/
536-- /Internal/
537{-# INLINABLE sliceSepBy #-}
537{-# INLINABLE sliceSepBy #-}
538sliceSepBy :: MonadCatch m => (a -> Bool) -> Fold m a b -> Parser m a b
538sliceSepBy :: MonadCatch m => (a -> Bool) -> Fold m a b -> Parser m a b
539−sliceSepBy cond = D.toParserK . D.sliceSepBy cond
539+sliceSepBy cond = K.toParserK . D.sliceSepBy cond
541-- | Like 'sliceSepBy' but does not drop the separator element, instead
541-- | Like 'sliceSepBy' but does not drop the separator element, instead
542-- separator is emitted as a separate element in the output.
542-- separator is emitted as a separate element in the output.
@@ -545,7 +545,7 @@ sliceSepBy cond = D.toParserK . D.sliceSepBy cond
545{-# INLINABLE sliceSepWith #-}
545{-# INLINABLE sliceSepWith #-}
546sliceSepWith :: -- MonadCatch m =>
546sliceSepWith :: -- MonadCatch m =>
547 (a -> Bool) -> Fold m a b -> Parser m a b
547 (a -> Bool) -> Fold m a b -> Parser m a b
548−sliceSepWith _cond = undefined -- D.toParserK . D.sliceSepBy cond
548+sliceSepWith _cond = undefined -- K.toParserK . D.sliceSepBy cond
550-- | Collect stream elements until an element succeeds the predicate. Also take
550-- | Collect stream elements until an element succeeds the predicate. Also take
551-- the element on which the predicate succeeded. The succeeding element is
551-- the element on which the predicate succeeded. The succeeding element is
@@ -619,7 +619,7 @@ sliceBeginWith = undefined
619{-# INLINABLE sliceSepByMax #-}
619{-# INLINABLE sliceSepByMax #-}
620sliceSepByMax :: MonadCatch m
620sliceSepByMax :: MonadCatch m
621 => (a -> Bool) -> Int -> Fold m a b -> Parser m a b
621 => (a -> Bool) -> Int -> Fold m a b -> Parser m a b
622−sliceSepByMax cond cnt = D.toParserK . D.sliceSepByMax cond cnt
622+sliceSepByMax cond cnt = K.toParserK . D.sliceSepByMax cond cnt
624-- | Like 'sliceSepBy' but the separator elements can be escaped using an
624-- | Like 'sliceSepBy' but the separator elements can be escaped using an
625-- escape char determined by the second predicate.
625-- escape char determined by the second predicate.
@@ -629,7 +629,7 @@ sliceSepByMax cond cnt = D.toParserK . D.sliceSepByMax cond cnt
629escapedSliceSepBy :: -- MonadCatch m =>
629escapedSliceSepBy :: -- MonadCatch m =>
630 (a -> Bool) -> (a -> Bool) -> Fold m a b -> Parser m a b
630 (a -> Bool) -> (a -> Bool) -> Fold m a b -> Parser m a b
631escapedSliceSepBy _cond _esc = undefined
631escapedSliceSepBy _cond _esc = undefined
632− -- D.toParserK . D.escapedSliceSepBy cond esc
632+ -- K.toParserK . D.escapedSliceSepBy cond esc
634-- | @escapedFrameBy begin end escape@ parses a string framed using @begin@ and
634-- | @escapedFrameBy begin end escape@ parses a string framed using @begin@ and
635-- @end@ as the frame begin and end marker elements and @escape@ as an escaping
635-- @end@ as the frame begin and end marker elements and @escape@ as an escaping
@@ -655,7 +655,7 @@ escapedSliceSepBy _cond _esc = undefined
655escapedFrameBy :: -- MonadCatch m =>
655escapedFrameBy :: -- MonadCatch m =>
656 (a -> Bool) -> (a -> Bool) -> (a -> Bool) -> Fold m a b -> Parser m a b
656 (a -> Bool) -> (a -> Bool) -> (a -> Bool) -> Fold m a b -> Parser m a b
657escapedFrameBy _begin _end _escape _p = undefined
657escapedFrameBy _begin _end _escape _p = undefined
658− -- D.toParserK . D.frameBy begin end escape p
658+ -- K.toParserK . D.frameBy begin end escape p
660-- | Like 'splitOn' but strips leading, trailing, and repeated separators.
660-- | Like 'splitOn' but strips leading, trailing, and repeated separators.
661-- Therefore, @".a..b."@ having '.' as the separator would be parsed as
661-- Therefore, @".a..b."@ having '.' as the separator would be parsed as
@@ -710,7 +710,7 @@ groupBy = undefined
711{-# INLINE eqBy #-}
711{-# INLINE eqBy #-}
712eqBy :: MonadCatch m => (a -> a -> Bool) -> [a] -> Parser m a ()
712eqBy :: MonadCatch m => (a -> a -> Bool) -> [a] -> Parser m a ()
713−eqBy cmp = D.toParserK . D.eqBy cmp
713+eqBy cmp = K.toParserK . D.eqBy cmp
715-------------------------------------------------------------------------------
715-------------------------------------------------------------------------------
716-- nested parsers
716-- nested parsers
@@ -742,7 +742,7 @@ eqBy cmp = D.toParserK . D.eqBy cmp
742splitWith :: MonadCatch m
742splitWith :: MonadCatch m
743 => (a -> b -> c) -> Parser m x a -> Parser m x b -> Parser m x c
743 => (a -> b -> c) -> Parser m x a -> Parser m x b -> Parser m x c
744splitWith f p1 p2 =
744splitWith f p1 p2 =
745− D.toParserK $ D.splitWith f (D.fromParserK p1) (D.fromParserK p2)
745+ K.toParserK $ D.splitWith f (K.fromParserK p1) (K.fromParserK p2)
747-- | Sequential parser application ignoring the output of the first parser.
747-- | Sequential parser application ignoring the output of the first parser.
748-- Apply two parsers sequentially to an input stream. The input is provided to
748-- Apply two parsers sequentially to an input stream. The input is provided to
@@ -764,7 +764,7 @@ splitWith f p1 p2 =
765{-# INLINE split_ #-}
765{-# INLINE split_ #-}
766split_ :: MonadCatch m => Parser m x a -> Parser m x b -> Parser m x b
766split_ :: MonadCatch m => Parser m x a -> Parser m x b -> Parser m x b
767−split_ p1 p2 = D.toParserK $ D.split_ (D.fromParserK p1) (D.fromParserK p2)
767+split_ p1 p2 = K.toParserK $ D.split_ (K.fromParserK p1) (K.fromParserK p2)
769-- | @teeWith f p1 p2@ distributes its input to both @p1@ and @p2@ until both
769-- | @teeWith f p1 p2@ distributes its input to both @p1@ and @p2@ until both
770-- of them succeed or anyone of them fails and combines their output using @f@.
770-- of them succeed or anyone of them fails and combines their output using @f@.
@@ -776,7 +776,7 @@ split_ p1 p2 = D.toParserK $ D.split_ (D.fromParserK p1) (D.fromParserK p2)
776teeWith :: MonadCatch m
776teeWith :: MonadCatch m
777 => (a -> b -> c) -> Parser m x a -> Parser m x b -> Parser m x c
777 => (a -> b -> c) -> Parser m x a -> Parser m x b -> Parser m x c
778teeWith f p1 p2 =
778teeWith f p1 p2 =
779− D.toParserK $ D.teeWith f (D.fromParserK p1) (D.fromParserK p2)
779+ K.toParserK $ D.teeWith f (K.fromParserK p1) (K.fromParserK p2)
781-- | Like 'teeWith' but ends parsing and zips the results, if available,
781-- | Like 'teeWith' but ends parsing and zips the results, if available,
782-- whenever the first parser ends.
782-- whenever the first parser ends.
@@ -787,7 +787,7 @@ teeWith f p1 p2 =
787teeWithFst :: MonadCatch m
787teeWithFst :: MonadCatch m
788 => (a -> b -> c) -> Parser m x a -> Parser m x b -> Parser m x c
788 => (a -> b -> c) -> Parser m x a -> Parser m x b -> Parser m x c
789teeWithFst f p1 p2 =
789teeWithFst f p1 p2 =
790− D.toParserK $ D.teeWithFst f (D.fromParserK p1) (D.fromParserK p2)
790+ K.toParserK $ D.teeWithFst f (K.fromParserK p1) (K.fromParserK p2)
792-- | Like 'teeWith' but ends parsing and zips the results, if available,
792-- | Like 'teeWith' but ends parsing and zips the results, if available,
793-- whenever any of the parsers ends or fails.
793-- whenever any of the parsers ends or fails.
@@ -798,7 +798,7 @@ teeWithFst f p1 p2 =
798teeWithMin :: MonadCatch m
798teeWithMin :: MonadCatch m
799 => (a -> b -> c) -> Parser m x a -> Parser m x b -> Parser m x c
799 => (a -> b -> c) -> Parser m x a -> Parser m x b -> Parser m x c
800teeWithMin f p1 p2 =
800teeWithMin f p1 p2 =
801− D.toParserK $ D.teeWithMin f (D.fromParserK p1) (D.fromParserK p2)
801+ K.toParserK $ D.teeWithMin f (K.fromParserK p1) (K.fromParserK p2)
803-- | Sequential alternative. Apply the input to the first parser and return the
803-- | Sequential alternative. Apply the input to the first parser and return the
804-- result if the parser succeeds. If the first parser fails then backtrack and
804-- result if the parser succeeds. If the first parser fails then backtrack and
@@ -818,7 +818,7 @@ teeWithMin f p1 p2 =
819{-# INLINE alt #-}
819{-# INLINE alt #-}
820alt :: MonadCatch m => Parser m x a -> Parser m x a -> Parser m x a
820alt :: MonadCatch m => Parser m x a -> Parser m x a -> Parser m x a
821−alt p1 p2 = D.toParserK $ D.alt (D.fromParserK p1) (D.fromParserK p2)
821+alt p1 p2 = K.toParserK $ D.alt (K.fromParserK p1) (K.fromParserK p2)
823-- | Shortest alternative. Apply both parsers in parallel but choose the result
823-- | Shortest alternative. Apply both parsers in parallel but choose the result
824-- from the one which consumed least input i.e. take the shortest succeeding
824-- from the one which consumed least input i.e. take the shortest succeeding
@@ -829,7 +829,7 @@ alt p1 p2 = D.toParserK $ D.alt (D.fromParserK p1) (D.fromParserK p2)
829{-# INLINE shortest #-}
829{-# INLINE shortest #-}
830shortest :: MonadCatch m
830shortest :: MonadCatch m
831 => Parser m x a -> Parser m x a -> Parser m x a
831 => Parser m x a -> Parser m x a -> Parser m x a
832−shortest p1 p2 = D.toParserK $ D.shortest (D.fromParserK p1) (D.fromParserK p2)
832+shortest p1 p2 = K.toParserK $ D.shortest (K.fromParserK p1) (K.fromParserK p2)
834-- | Longest alternative. Apply both parsers in parallel but choose the result
834-- | Longest alternative. Apply both parsers in parallel but choose the result
835-- from the one which consumed more input i.e. take the longest succeeding
835-- from the one which consumed more input i.e. take the longest succeeding
@@ -840,7 +840,7 @@ shortest p1 p2 = D.toParserK $ D.shortest (D.fromParserK p1) (D.fromParserK p2)
840{-# INLINE longest #-}
840{-# INLINE longest #-}
841longest :: MonadCatch m
841longest :: MonadCatch m
842 => Parser m x a -> Parser m x a -> Parser m x a
842 => Parser m x a -> Parser m x a -> Parser m x a
843−longest p1 p2 = D.toParserK $ D.longest (D.fromParserK p1) (D.fromParserK p2)
843+longest p1 p2 = K.toParserK $ D.longest (K.fromParserK p1) (K.fromParserK p2)
845-- | Run a parser without consuming the input.
845-- | Run a parser without consuming the input.
@@ -848,7 +848,7 @@ longest p1 p2 = D.toParserK $ D.longest (D.fromParserK p1) (D.fromParserK p2)
849{-# INLINE lookAhead #-}
849{-# INLINE lookAhead #-}
850lookAhead :: MonadCatch m => Parser m a b -> Parser m a b
850lookAhead :: MonadCatch m => Parser m a b -> Parser m a b
851−lookAhead p = D.toParserK $ D.lookAhead $ D.fromParserK p
851+lookAhead p = K.toParserK $ D.lookAhead $ K.fromParserK p
853-------------------------------------------------------------------------------
853-------------------------------------------------------------------------------
854-- Interleaving
854-- Interleaving
@@ -915,7 +915,7 @@ sequence _f _p = undefined
915{-# INLINE concatMap #-}
915{-# INLINE concatMap #-}
916concatMap :: MonadCatch m
916concatMap :: MonadCatch m
917 => (b -> Parser m a c) -> Parser m a b -> Parser m a c
917 => (b -> Parser m a c) -> Parser m a b -> Parser m a c
918−concatMap f p = D.toParserK $ D.concatMap (D.fromParserK . f) (D.fromParserK p)
918+concatMap f p = K.toParserK $ D.concatMap (K.fromParserK . f) (K.fromParserK p)
920-------------------------------------------------------------------------------
920-------------------------------------------------------------------------------
921-- Alternative Collection
921-- Alternative Collection
@@ -951,7 +951,7 @@ choice _ps = undefined
951{-# INLINE manyP #-}
951{-# INLINE manyP #-}
952manyP :: -- MonadCatch m =>
952manyP :: -- MonadCatch m =>
953 Parser m b c -> Parser m a b -> Parser m a c
953 Parser m b c -> Parser m a b -> Parser m a c
954−manyP _f _p = undefined -- D.toParserK $ D.manyP f (D.fromParserK p)
954+manyP _f _p = undefined -- K.toParserK $ D.manyP f (K.fromParserK p)
956-- | Collect zero or more parses. Apply the parser repeatedly on the input
956-- | Collect zero or more parses. Apply the parser repeatedly on the input
957-- stream, stop when the parser fails, accumulate zero or more parse results
957-- stream, stop when the parser fails, accumulate zero or more parse results
@@ -964,7 +964,7 @@ manyP _f _p = undefined -- D.toParserK $ D.manyP f (D.fromParserK p)
965{-# INLINE many #-}
965{-# INLINE many #-}
966many :: MonadCatch m => Fold m b c -> Parser m a b -> Parser m a c
966many :: MonadCatch m => Fold m b c -> Parser m a b -> Parser m a c
967−many f p = D.toParserK $ D.many f (D.fromParserK p)
967+many f p = K.toParserK $ D.many f (K.fromParserK p)
968-- many = countBetween 0 maxBound
968-- many = countBetween 0 maxBound
970-- | Collect one or more parses. Apply the supplied parser repeatedly on the
970-- | Collect one or more parses. Apply the supplied parser repeatedly on the
@@ -978,7 +978,7 @@ many f p = D.toParserK $ D.many f (D.fromParserK p)
979{-# INLINE some #-}
979{-# INLINE some #-}
980some :: MonadCatch m => Fold m b c -> Parser m a b -> Parser m a c
980some :: MonadCatch m => Fold m b c -> Parser m a b -> Parser m a c
981−some f p = D.toParserK $ D.some f (D.fromParserK p)
981+some f p = K.toParserK $ D.some f (K.fromParserK p)
982-- some f p = manyP (takeGE 1 f) p
982-- some f p = manyP (takeGE 1 f) p
983-- many = countBetween 1 maxBound
983-- many = countBetween 1 maxBound
@@ -1023,7 +1023,7 @@ count n = countBetween n n
1023manyTillP :: -- MonadCatch m =>
1023manyTillP :: -- MonadCatch m =>
1024 Parser m b c -> Parser m a b -> Parser m a x -> Parser m a c
1024 Parser m b c -> Parser m a b -> Parser m a x -> Parser m a c
1025manyTillP _f _p1 _p2 = undefined
1025manyTillP _f _p1 _p2 = undefined
1026− -- D.toParserK $ D.manyTillP f (D.fromParserK p1) (D.fromParserK p2)
1026+ -- K.toParserK $ D.manyTillP f (K.fromParserK p1) (K.fromParserK p2)
1028-- | @manyTill f collect test@ tries the parser @test@ on the input, if @test@
1028-- | @manyTill f collect test@ tries the parser @test@ on the input, if @test@
1029-- fails it backtracks and tries @collect@, after @collect@ succeeds @test@ is
1029-- fails it backtracks and tries @collect@, after @collect@ succeeds @test@ is
@@ -1037,7 +1037,7 @@ manyTillP _f _p1 _p2 = undefined
1037manyTill :: MonadCatch m
1037manyTill :: MonadCatch m
1038 => Fold m b c -> Parser m a b -> Parser m a x -> Parser m a c
1038 => Fold m b c -> Parser m a b -> Parser m a x -> Parser m a c
1039manyTill f p1 p2 =
1039manyTill f p1 p2 =
1040− D.toParserK $ D.manyTill f (D.fromParserK p1) (D.fromParserK p2)
1040+ K.toParserK $ D.manyTill f (K.fromParserK p1) (K.fromParserK p2)
1042-- | @manyThen f collect recover@ repeats the parser @collect@ on the input and
1042-- | @manyThen f collect recover@ repeats the parser @collect@ on the input and
1043-- collects the output in the supplied fold. If the the parser @collect@ fails,
1043-- collects the output in the supplied fold. If the the parser @collect@ fails,