@@ -576,25 +576,35 @@ escapedFrameBy _begin _end _escape _p = undefined
576wordBy :: MonadCatch m => (a -> Bool) -> Fold m a b -> Parser m a b
576wordBy :: MonadCatch m => (a -> Bool) -> Fold m a b -> Parser m a b
577wordBy f = K.toParserK . D.wordBy f
577wordBy f = K.toParserK . D.wordBy f
579+-- | Given an input stream @[a,b,c,...]@ and a comparison function @cmp@, the
579−-- | @groupBy cmp f $ S.fromList [a,b,c,...]@ assigns the element @a@ to the
580+-- parser assigns the element @a@ to the first group, then if @a \`cmp` b@ is
580−-- first group, then if @a \`cmp` b@ is 'True' @b@ is also assigned to the same
581+-- 'True' @b@ is also assigned to the same group. If @a \`cmp` c@ is 'True'
581−-- group. If @a \`cmp` c@ is 'True' then @c@ is also assigned to the same
582+-- then @c@ is also assigned to the same group and so on. When the comparison
582−-- group and so on. When the comparison fails a new group is started. Each
583−-- group is folded using the 'Fold' @f@ and the result of the fold is emitted
583+-- fails the parser is terminated. Each group is folded using the 'Fold' @f@ and
584−-- in the output stream.
584+-- the result of the fold is the result of the parser.
586-- * Stops - when the comparison fails.
586-- * Stops - when the comparison fails.
587-- * Fails - never.
587-- * Fails - never.
589−-- @
589+-- > runGroupsBy eq =
590−-- S.groupsBy cmp f = S.parseMany (PR.groupBy cmp f)
591+-- > . Stream.parseMany (groupBy eq Fold.toList)
591−-- @
592+-- > . Stream.fromList
593−-- /Unimplemented/
594+-- >>> runGroupsBy (<) []
597+-- >>> runGroupsBy (<) [1]
600+-- >>> runGroupsBy (<) [3, 5, 4, 1, 2, 0]
601+-- [[3, 5, 4], [1, 2], [0]]
595{-# INLINABLE groupBy #-}
605{-# INLINABLE groupBy #-}
596groupBy :: MonadCatch m => (a -> a -> Bool) -> Fold m a b -> Parser m a b
606groupBy :: MonadCatch m => (a -> a -> Bool) -> Fold m a b -> Parser m a b
597−groupBy cmp = K.toParserK . D.groupBy cmp
607+groupBy eq = K.toParserK . D.groupBy eq
599-- | Unlike 'groupBy' this combinator performs a rolling comparison of two
609-- | Unlike 'groupBy' this combinator performs a rolling comparison of two
600-- successive elements in the input stream. Assuming the input stream to the
610-- successive elements in the input stream. Assuming the input stream to the