@@ -77,7 +77,7 @@ module Streamly.Internal.Data.Stream.StreamD.Type
77 , concatUnfold
77 , concatUnfold
78 , concatMap
78 , concatMap
79 , concatMapM
79 , concatMapM
80− , GroupState (..) -- for inspection testing
80+ , FoldMany (..) -- for inspection testing
81 , foldMany
81 , foldMany
82 , foldMany1
82 , foldMany1
83 , groupsOf2
83 , groupsOf2
@@ -786,13 +786,13 @@ instance Monad m => Monad (Stream m) where
786------------------------------------------------------------------------------
786------------------------------------------------------------------------------
788-- s = stream state, fs = fold state
788-- s = stream state, fs = fold state
789−{-# ANN type GroupState Fuse #-}
789+{-# ANN type FoldMany Fuse #-}
790−data GroupState s fs b a
790+data FoldMany s fs b a
791− = GroupStart s
791+ = FoldManyStart s
792− | GroupConsume s fs a
792+ | FoldManyConsume s fs a
793− | GroupBuffer s fs
793+ | FoldManyBuffer s fs
794− | GroupYield b (GroupState s fs b a)
794+ | FoldManyYield b (FoldMany s fs b a)
795− | GroupFinish
795+ | FoldManyFinish
797-- | This is the stream equivalent of "Data.Fold.Internal.many". The fold
797-- | This is the stream equivalent of "Data.Fold.Internal.many". The fold
798-- may consume 0 or more elements. It means:
798-- may consume 0 or more elements. It means:
@@ -806,37 +806,37 @@ data GroupState s fs b a
806{-# INLINE_NORMAL foldMany #-}
806{-# INLINE_NORMAL foldMany #-}
807foldMany :: Monad m => Fold m a b -> Stream m a -> Stream m b
807foldMany :: Monad m => Fold m a b -> Stream m a -> Stream m b
808foldMany (Fold fstep initial extract) (Stream step state) =
808foldMany (Fold fstep initial extract) (Stream step state) =
809− Stream step' (GroupStart state)
809+ Stream step' (FoldManyStart state)
813 {-# INLINE_LATE step' #-}
813 {-# INLINE_LATE step' #-}
814− step' _ (GroupStart st) = do
814+ step' _ (FoldManyStart st) = do
815 r <- initial
815 r <- initial
818 $ case r of
818 $ case r of
819− FL.Done b -> GroupYield b (GroupStart st)
819+ FL.Done b -> FoldManyYield b (FoldManyStart st)
820− FL.Partial fs -> GroupBuffer st fs
820+ FL.Partial fs -> FoldManyBuffer st fs
821 -- This state is not strictly required but it helps the compiler fuse the
821 -- This state is not strictly required but it helps the compiler fuse the
823− step' _ (GroupConsume st fs x) = do
823+ step' _ (FoldManyConsume st fs x) = do
824 r <- fstep fs x
824 r <- fstep fs x
827 $ case r of
827 $ case r of
828− FL.Done b -> GroupYield b (GroupStart st)
828+ FL.Done b -> FoldManyYield b (FoldManyStart st)
829− FL.Partial fs1 -> GroupBuffer st fs1
829+ FL.Partial fs1 -> FoldManyBuffer st fs1
830− step' gst (GroupBuffer st fs) = do
830+ step' gst (FoldManyBuffer st fs) = do
831 r <- step (adaptState gst) st
831 r <- step (adaptState gst) st
832 case r of
832 case r of
833− Yield x s -> return $ Skip $ GroupConsume s fs x
833+ Yield x s -> return $ Skip $ FoldManyConsume s fs x
834− Skip s -> return $ Skip (GroupBuffer s fs)
834+ Skip s -> return $ Skip (FoldManyBuffer s fs)
835 Stop -> do
835 Stop -> do
836 b <- extract fs
836 b <- extract fs
837− return $ Skip (GroupYield b GroupFinish)
837+ return $ Skip (FoldManyYield b FoldManyFinish)
838− step' _ (GroupYield b next) = return $ Yield b next
838+ step' _ (FoldManyYield b next) = return $ Yield b next
839− step' _ GroupFinish = return Stop
839+ step' _ FoldManyFinish = return Stop
841{-# ANN type FoldMany1 Fuse #-}
841{-# ANN type FoldMany1 Fuse #-}
842data FoldMany1 s fs b a
842data FoldMany1 s fs b a