@@ -108,7 +108,7 @@ module Streamly.Internal.Data.Parser
108 , dropWhile
108 , dropWhile
110 -- ** Separators
110 -- ** Separators
111− -- , takeEndBy
111+ , takeEndBy
112 , takeEndBy_
112 , takeEndBy_
113 , takeEndByEsc
113 , takeEndByEsc
114 -- , takeEndByEsc_
114 -- , takeEndByEsc_
@@ -661,13 +661,25 @@ dropWhile p = takeWhile p FL.drain
661-------------------------------------------------------------------------------
661-------------------------------------------------------------------------------
663-- | @takeEndBy_ cond parser@ parses a token that ends by a separator chosen by
663-- | @takeEndBy_ cond parser@ parses a token that ends by a separator chosen by
664−-- the supplied predicate. The separator is dropped.
664+-- the supplied predicate. The separator is also taken with the token.
666-- This can be combined with other parsers to implement other interesting
666-- This can be combined with other parsers to implement other interesting
667-- parsers as follows:
667-- parsers as follows:
669−-- >>> takeEndByOrMax cond n p = Parser.takeEndBy_ cond (Parser.fromFold $ Fold.take n p)
669+-- >>> takeEndByLE cond n p = Parser.takeEndBy cond (Parser.fromFold $ Fold.take n p)
670−-- >>> takeEndByBetween cond m n p = Parser.takeEndBy_ cond (Parser.takeBetween m n p)
670+-- >>> takeEndByBetween cond m n p = Parser.takeEndBy cond (Parser.takeBetween m n p)
672+-- See also "Streamly.Data.Fold.takeEndBy".
676+{-# INLINE takeEndBy #-}
677+takeEndBy :: MonadCatch m => (a -> Bool) -> Parser m a b -> Parser m a b
678+takeEndBy cond = D.toParserK . D.takeEndBy cond . D.fromParserK
680+-- | Like 'takeEndBy' but the separator is dropped.
682+-- See also "Streamly.Data.Fold.takeEndBy_".
672-- /Pre-release/
684-- /Pre-release/