@@ -108,7 +108,7 @@ module Streamly.Internal.Data.Parser
108108 , dropWhile
109109
110110 -- ** Separators
111− -- , takeEndBy
111+ , takeEndBy
112112 , takeEndBy_
113113 , takeEndByEsc
114114 -- , takeEndByEsc_
@@ -661,13 +661,25 @@ dropWhile p = takeWhile p FL.drain
661661-------------------------------------------------------------------------------
662662
663663-- | @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.
665665--
666666-- This can be combined with other parsers to implement other interesting
667667-- parsers as follows:
668668--
669−-- >>> takeEndByOrMax 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)
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)
671+--
672+-- See also "Streamly.Data.Fold.takeEndBy".
673+--
674+-- /Pre-release/
675+--
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
679+
680+-- | Like 'takeEndBy' but the separator is dropped.
681+--
682+-- See also "Streamly.Data.Fold.takeEndBy_".
671683--
672684-- /Pre-release/
673685--