@@ -97,6 +97,7 @@ module Streamly.Internal.Data.Parser
9797 , wordBy
9898 , groupBy
9999 , groupByRolling
100+ , groupByRollingEither
100101 , eqBy
101102 -- | Unimplemented
102103 --
@@ -699,6 +700,21 @@ groupBy eq = K.toParserK . D.groupBy eq
699700groupByRolling :: MonadCatch m => (a -> a -> Bool) -> Fold m a b -> Parser m a b
700701groupByRolling eq = K.toParserK . D.groupByRolling eq
701702
703+-- | Like 'groupByRolling', but if the predicate is 'True' then collects using
704+-- the first fold as long as the predicate holds 'True', if the predicate is
705+-- 'False' collects using the second fold as long as it remains 'False'.
706+-- Returns 'Left' for the first case and 'Right' for the second case.
707+--
708+-- For example, if we want to detect sorted sequences in a stream, both
709+-- ascending and descending cases we can use 'groupByRollingEither (<=)
710+-- Fold.toList Fold.toList'.
711+--
712+-- /Unimplemented/
713+{-# INLINABLE groupByRollingEither #-}
714+groupByRollingEither :: -- MonadCatch m =>
715+ (a -> a -> Bool) -> Fold m a b -> Fold m a b -> Parser m a (Either b b)
716+groupByRollingEither = undefined
717+
702718-- | Match the given sequence of elements using the given comparison function.
703719--
704720-- >>> Stream.parse (Parser.eqBy (==) "string") $ Stream.fromList "string"