@@ -77,7 +77,7 @@ module Streamly.Internal.Data.Stream.StreamD.Type
7777 , concatUnfold
7878 , concatMap
7979 , concatMapM
80− , GroupState (..) -- for inspection testing
80+ , FoldMany (..) -- for inspection testing
8181 , foldMany
8282 , foldMany1
8383 , groupsOf2
@@ -786,13 +786,13 @@ instance Monad m => Monad (Stream m) where
786786------------------------------------------------------------------------------
787787
788788-- s = stream state, fs = fold state
789−{-# ANN type GroupState Fuse #-}
790−data GroupState s fs b a
791− = GroupStart s
792− | GroupConsume s fs a
793− | GroupBuffer s fs
794− | GroupYield b (GroupState s fs b a)
795− | GroupFinish
789+{-# ANN type FoldMany Fuse #-}
790+data FoldMany s fs b a
791+ = FoldManyStart s
792+ | FoldManyConsume s fs a
793+ | FoldManyBuffer s fs
794+ | FoldManyYield b (FoldMany s fs b a)
795+ | FoldManyFinish
796796
797797-- | This is the stream equivalent of "Data.Fold.Internal.many". The fold
798798-- may consume 0 or more elements. It means:
@@ -806,37 +806,37 @@ data GroupState s fs b a
806806{-# INLINE_NORMAL foldMany #-}
807807foldMany :: Monad m => Fold m a b -> Stream m a -> Stream m b
808808foldMany (Fold fstep initial extract) (Stream step state) =
809− Stream step' (GroupStart state)
809+ Stream step' (FoldManyStart state)
810810
811811 where
812812
813813 {-# INLINE_LATE step' #-}
814− step' _ (GroupStart st) = do
814+ step' _ (FoldManyStart st) = do
815815 r <- initial
816816 return
817817 $ Skip
818818 $ case r of
819− FL.Done b -> GroupYield b (GroupStart st)
820− FL.Partial fs -> GroupBuffer st fs
819+ FL.Done b -> FoldManyYield b (FoldManyStart st)
820+ FL.Partial fs -> FoldManyBuffer st fs
821821 -- This state is not strictly required but it helps the compiler fuse the
822822 -- code.
823− step' _ (GroupConsume st fs x) = do
823+ step' _ (FoldManyConsume st fs x) = do
824824 r <- fstep fs x
825825 return
826826 $ Skip
827827 $ case r of
828− FL.Done b -> GroupYield b (GroupStart st)
829− FL.Partial fs1 -> GroupBuffer st fs1
830− step' gst (GroupBuffer st fs) = do
828+ FL.Done b -> FoldManyYield b (FoldManyStart st)
829+ FL.Partial fs1 -> FoldManyBuffer st fs1
830+ step' gst (FoldManyBuffer st fs) = do
831831 r <- step (adaptState gst) st
832832 case r of
833− Yield x s -> return $ Skip $ GroupConsume s fs x
834− Skip s -> return $ Skip (GroupBuffer s fs)
833+ Yield x s -> return $ Skip $ FoldManyConsume s fs x
834+ Skip s -> return $ Skip (FoldManyBuffer s fs)
835835 Stop -> do
836836 b <- extract fs
837− return $ Skip (GroupYield b GroupFinish)
838− step' _ (GroupYield b next) = return $ Yield b next
839− step' _ GroupFinish = return Stop
837+ return $ Skip (FoldManyYield b FoldManyFinish)
838+ step' _ (FoldManyYield b next) = return $ Yield b next
839+ step' _ FoldManyFinish = return Stop
840840
841841{-# ANN type FoldMany1 Fuse #-}
842842data FoldMany1 s fs b a