@@ -97,6 +97,7 @@ module Streamly.Internal.Data.Parser
99 , groupByRolling
99 , groupByRolling
100+ , groupByRollingEither
101 -- | Unimplemented
102 -- | Unimplemented
@@ -699,6 +700,21 @@ groupBy eq = K.toParserK . D.groupBy eq
699groupByRolling :: MonadCatch m => (a -> a -> Bool) -> Fold m a b -> Parser m a b
700groupByRolling :: MonadCatch m => (a -> a -> Bool) -> Fold m a b -> Parser m a b
700groupByRolling eq = K.toParserK . D.groupByRolling eq
701groupByRolling eq = K.toParserK . D.groupByRolling eq
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.
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'.
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
702-- | Match the given sequence of elements using the given comparison function.
718-- | Match the given sequence of elements using the given comparison function.
704-- >>> Stream.parse (Parser.eqBy (==) "string") $ Stream.fromList "string"
720-- >>> Stream.parse (Parser.eqBy (==) "string") $ Stream.fromList "string"