on master help sign in
Rename foldMany and foldMany1
11831beHarendra Kumar
benchmark/Streamly/Benchmark/FileSystem/Handle/Read.hs+14−14
@@ -49,7 +49,7 @@ import Prelude hiding (last, length)
49import Streamly.Benchmark.Common.Handle
49import Streamly.Benchmark.Common.Handle
50
50
51#ifdef INSPECTION
51#ifdef INSPECTION
52−import Streamly.Internal.Data.Stream.StreamD.Type (Step(..), FoldMany1)
52+import Streamly.Internal.Data.Stream.StreamD.Type (Step(..), FoldMany)
53
53
54import qualified Streamly.Internal.Data.Array.Foreign.Mut.Types as MA
54import qualified Streamly.Internal.Data.Array.Foreign.Mut.Types as MA
55import qualified Streamly.Internal.Data.Stream.StreamD as D
55import qualified Streamly.Internal.Data.Stream.StreamD as D
@@ -310,14 +310,14 @@ o_1_space_reduce_toBytes env =
310chunksOfSum :: Int -> Handle -> IO Int
310chunksOfSum :: Int -> Handle -> IO Int
311chunksOfSum n inh = S.length $ S.chunksOf n FL.sum (S.unfold FH.read inh)
311chunksOfSum n inh = S.length $ S.chunksOf n FL.sum (S.unfold FH.read inh)
312
312
313+foldManyPostChunksOfSum :: Int -> Handle -> IO Int
314+foldManyPostChunksOfSum n inh =
315+ S.length $ IP.foldManyPost (FL.takeLE n FL.sum) (S.unfold FH.read inh)
316+
313foldManyChunksOfSum :: Int -> Handle -> IO Int
317foldManyChunksOfSum :: Int -> Handle -> IO Int
314foldManyChunksOfSum n inh =
318foldManyChunksOfSum n inh =
315 S.length $ IP.foldMany (FL.takeLE n FL.sum) (S.unfold FH.read inh)
319 S.length $ IP.foldMany (FL.takeLE n FL.sum) (S.unfold FH.read inh)
316
320
317−foldMany1ChunksOfSum :: Int -> Handle -> IO Int
318−foldMany1ChunksOfSum n inh =
319− S.length $ IP.foldMany1 (FL.takeLE n FL.sum) (S.unfold FH.read inh)
320−
321parseManyChunksOfSum :: Int -> Handle -> IO Int
321parseManyChunksOfSum :: Int -> Handle -> IO Int
322parseManyChunksOfSum n inh =
322parseManyChunksOfSum n inh =
323 S.length
323 S.length
@@ -336,7 +336,7 @@ chunksOf n inh =
336#ifdef INSPECTION
336#ifdef INSPECTION
337inspect $ hasNoTypeClasses 'chunksOf
337inspect $ hasNoTypeClasses 'chunksOf
338inspect $ 'chunksOf `hasNoType` ''Step
338inspect $ 'chunksOf `hasNoType` ''Step
339−inspect $ 'chunksOf `hasNoType` ''FoldMany1
339+inspect $ 'chunksOf `hasNoType` ''FoldMany
340inspect $ 'chunksOf `hasNoType` ''AT.ArrayUnsafe -- AT.writeNUnsafe
340inspect $ 'chunksOf `hasNoType` ''AT.ArrayUnsafe -- AT.writeNUnsafe
341inspect $ 'chunksOf `hasNoType` ''IUF.ConcatState -- FH.read/UF.concat
341inspect $ 'chunksOf `hasNoType` ''IUF.ConcatState -- FH.read/UF.concat
342inspect $ 'chunksOf `hasNoType` ''MA.ReadUState -- FH.read/A.read
342inspect $ 'chunksOf `hasNoType` ''MA.ReadUState -- FH.read/A.read
@@ -358,21 +358,21 @@ o_1_space_reduce_read_grouped env =
358 -- XXX investigate why we need inline/noinline in these cases (GHC)
358 -- XXX investigate why we need inline/noinline in these cases (GHC)
359 -- Chunk using parsers
359 -- Chunk using parsers
360 , mkBench
360 , mkBench
361− ("S.foldMany (FL.take " ++ show (bigSize env) ++ " FL.sum)")
361+ ("S.foldManyPost (FL.take " ++ show (bigSize env) ++ " FL.sum)")
362 env
362 env
363− $ \inh _ -> noinline foldManyChunksOfSum (bigSize env) inh
363+ $ \inh _ -> noinline foldManyPostChunksOfSum (bigSize env) inh
364 , mkBench
364 , mkBench
365− "S.foldMany (FL.take 1 FL.sum)"
365+ "S.foldManyPost (FL.take 1 FL.sum)"
366 env
366 env
367− $ \inh _ -> inline foldManyChunksOfSum 1 inh
367+ $ \inh _ -> inline foldManyPostChunksOfSum 1 inh
368 , mkBench
368 , mkBench
369− ("S.foldMany1 (FL.take " ++ show (bigSize env) ++ " FL.sum)")
369+ ("S.foldMany (FL.take " ++ show (bigSize env) ++ " FL.sum)")
370 env
370 env
371− $ \inh _ -> noinline foldMany1ChunksOfSum (bigSize env) inh
371+ $ \inh _ -> noinline foldManyChunksOfSum (bigSize env) inh
372 , mkBench
372 , mkBench
373− "S.foldMany1 (FL.take 1 FL.sum)"
373+ "S.foldMany (FL.take 1 FL.sum)"
374 env
374 env
375− $ \inh _ -> inline foldMany1ChunksOfSum 1 inh
375+ $ \inh _ -> inline foldManyChunksOfSum 1 inh
376 , mkBench
376 , mkBench
377 ("S.parseMany (FL.take " ++ show (bigSize env) ++ " FL.sum)")
377 ("S.parseMany (FL.take " ++ show (bigSize env) ++ " FL.sum)")
378 env
378 env
benchmark/Streamly/Benchmark/FileSystem/Handle/ReadWrite.hs+2−2
@@ -112,7 +112,7 @@ inspect $ hasNoTypeClasses 'readFromBytesNull
112inspect $ 'readFromBytesNull `hasNoType` ''Step
112inspect $ 'readFromBytesNull `hasNoType` ''Step
113inspect $ 'readFromBytesNull `hasNoType` ''MAS.SpliceState
113inspect $ 'readFromBytesNull `hasNoType` ''MAS.SpliceState
114inspect $ 'readFromBytesNull `hasNoType` ''AT.ArrayUnsafe -- FH.fromBytes/S.arraysOf
114inspect $ 'readFromBytesNull `hasNoType` ''AT.ArrayUnsafe -- FH.fromBytes/S.arraysOf
115−inspect $ 'readFromBytesNull `hasNoType` ''D.FoldMany1
115+inspect $ 'readFromBytesNull `hasNoType` ''D.FoldMany
116#endif
116#endif
117
117
118-- | Send the file contents ('defaultChunkSize') to /dev/null
118-- | Send the file contents ('defaultChunkSize') to /dev/null
@@ -126,7 +126,7 @@ inspect $ hasNoTypeClasses 'readWithBufferOfFromBytesNull
126inspect $ 'readWithBufferOfFromBytesNull `hasNoType` ''Step
126inspect $ 'readWithBufferOfFromBytesNull `hasNoType` ''Step
127inspect $ 'readWithBufferOfFromBytesNull `hasNoType` ''MAS.SpliceState
127inspect $ 'readWithBufferOfFromBytesNull `hasNoType` ''MAS.SpliceState
128inspect $ 'readWithBufferOfFromBytesNull `hasNoType` ''AT.ArrayUnsafe -- FH.fromBytes/S.arraysOf
128inspect $ 'readWithBufferOfFromBytesNull `hasNoType` ''AT.ArrayUnsafe -- FH.fromBytes/S.arraysOf
129−inspect $ 'readWithBufferOfFromBytesNull `hasNoType` ''D.FoldMany1
129+inspect $ 'readWithBufferOfFromBytesNull `hasNoType` ''D.FoldMany
130#endif
130#endif
131
131
132-- | Send the chunk content ('defaultChunkSize') to /dev/null
132-- | Send the chunk content ('defaultChunkSize') to /dev/null
src/Streamly/Internal/Data/Stream/IsStream/Nesting.hs+18−20
@@ -127,7 +127,7 @@ module Streamly.Internal.Data.Stream.IsStream.Nesting
127 -- ** Folding
127 -- ** Folding
128 -- | Apply folds on a stream.
128 -- | Apply folds on a stream.
129 , foldMany
129 , foldMany
130− , foldMany1
130+ , foldManyPost
131 , foldSequence
131 , foldSequence
132 , foldIterate
132 , foldIterate
133
133
@@ -903,26 +903,26 @@ iterateMapLeftsWith combine f = iterateMapWith combine (either f (const K.nil))
903--
903--
904-- XXX We need takeGE/takeBetween to implement "some" using "many".
904-- XXX We need takeGE/takeBetween to implement "some" using "many".
905
905
906−-- | Like 'foldMany1' but appends empty fold output if the fold and stream
906+-- | Like 'foldMany' but appends empty fold output if the fold and stream
907-- termination aligns:
907-- termination aligns:
908--
908--
909-- >>> f = Fold.takeLE 2 Fold.sum
909-- >>> f = Fold.takeLE 2 Fold.sum
910−-- >>> Stream.toList $ Stream.foldMany f $ Stream.fromList []
910+-- >>> Stream.toList $ Stream.foldManyPost f $ Stream.fromList []
911-- > [0]
911-- > [0]
912−-- >>> Stream.toList $ Stream.foldMany f $ Stream.fromList [1..9]
912+-- >>> Stream.toList $ Stream.foldManyPost f $ Stream.fromList [1..9]
913-- > [3,7,11,15,9]
913-- > [3,7,11,15,9]
914−-- >>> Stream.toList $ Stream.foldMany f $ Stream.fromList [1..10]
914+-- >>> Stream.toList $ Stream.foldManyPost f $ Stream.fromList [1..10]
915-- > [3,7,11,15,19,0]
915-- > [3,7,11,15,19,0]
916--
916--
917-- /Internal/
917-- /Internal/
918--
918--
919−{-# INLINE foldMany #-}
919+{-# INLINE foldManyPost #-}
920−foldMany
920+foldManyPost
921 :: (IsStream t, Monad m)
921 :: (IsStream t, Monad m)
922 => Fold m a b
922 => Fold m a b
923 -> t m a
923 -> t m a
924 -> t m b
924 -> t m b
925−foldMany f m = D.fromStreamD $ D.foldMany f (D.toStreamD m)
925+foldManyPost f m = D.fromStreamD $ D.foldManyPost f (D.toStreamD m)
926
926
927-- | Apply a 'Fold' repeatedly on a stream and emit the fold outputs in the
927-- | Apply a 'Fold' repeatedly on a stream and emit the fold outputs in the
928-- output stream.
928-- output stream.
@@ -930,26 +930,26 @@ foldMany f m = D.fromStreamD $ D.foldMany f (D.toStreamD m)
930-- To sum every two contiguous elements in a stream:
930-- To sum every two contiguous elements in a stream:
931--
931--
932-- >>> f = Fold.takeLE 2 Fold.sum
932-- >>> f = Fold.takeLE 2 Fold.sum
933−-- >>> Stream.toList $ Stream.foldMany1 f $ Stream.fromList [1..10]
933+-- >>> Stream.toList $ Stream.foldMany f $ Stream.fromList [1..10]
934-- > [3,7,11,15,19]
934-- > [3,7,11,15,19]
935--
935--
936-- On an empty stream the output is empty:
936-- On an empty stream the output is empty:
937--
937--
938−-- >>> Stream.toList $ Stream.foldMany1 f $ Stream.fromList []
938+-- >>> Stream.toList $ Stream.foldMany f $ Stream.fromList []
939-- > []
939-- > []
940--
940--
941−-- Note @foldMany1 (takeLE 0)@ would result in an infinite loop in a non-empty
941+-- Note @foldMany (takeLE 0)@ would result in an infinite loop in a non-empty
942-- stream.
942-- stream.
943--
943--
944-- /Internal/
944-- /Internal/
945--
945--
946−{-# INLINE foldMany1 #-}
946+{-# INLINE foldMany #-}
947−foldMany1
947+foldMany
948 :: (IsStream t, Monad m)
948 :: (IsStream t, Monad m)
949 => Fold m a b
949 => Fold m a b
950 -> t m a
950 -> t m a
951 -> t m b
951 -> t m b
952−foldMany1 f m = D.fromStreamD $ D.foldMany1 f (D.toStreamD m)
952+foldMany f m = D.fromStreamD $ D.foldMany f (D.toStreamD m)
953
953
954-- | Apply a stream of folds to an input stream and emit the results in the
954-- | Apply a stream of folds to an input stream and emit the results in the
955-- output stream.
955-- output stream.
@@ -1005,7 +1005,7 @@ foldIterate _f _i _m = undefined
1005-- > ["hello\n","world"]
1005-- > ["hello\n","world"]
1006--
1006--
1007-- @
1007-- @
1008−-- foldMany1 f = parseMany (fromFold f)
1008+-- foldMany f = parseMany (fromFold f)
1009-- @
1009-- @
1010--
1010--
1011-- Known Issues: When the parser fails there is no way to get the remaining
1011-- Known Issues: When the parser fails there is no way to get the remaining
@@ -1289,7 +1289,7 @@ splitOn predicate f =
1289 --
1289 --
1290 -- Since a suffix split fold can be easily expressed using a
1290 -- Since a suffix split fold can be easily expressed using a
1291 -- non-backtracking fold, we use that.
1291 -- non-backtracking fold, we use that.
1292− foldMany (FL.sliceSepBy predicate f)
1292+ foldManyPost (FL.sliceSepBy predicate f)
1293
1293
1294-- | Split on a suffixed separator element, dropping the separator. The
1294-- | Split on a suffixed separator element, dropping the separator. The
1295-- supplied 'Fold' is applied on the split segments.
1295-- supplied 'Fold' is applied on the split segments.
@@ -1342,8 +1342,7 @@ splitOn predicate f =
1342splitOnSuffix
1342splitOnSuffix
1343 :: (IsStream t, Monad m)
1343 :: (IsStream t, Monad m)
1344 => (a -> Bool) -> Fold m a b -> t m a -> t m b
1344 => (a -> Bool) -> Fold m a b -> t m a -> t m b
1345−splitOnSuffix predicate f m =
1345+splitOnSuffix predicate f = foldMany (FL.sliceSepBy predicate f)
1346− D.fromStreamD $ D.foldMany1 (FL.sliceSepBy predicate f) (D.toStreamD m)
1347
1346
1348-- | Split on a prefixed separator element, dropping the separator. The
1347-- | Split on a prefixed separator element, dropping the separator. The
1349-- supplied 'Fold' is applied on the split segments.
1348-- supplied 'Fold' is applied on the split segments.
@@ -1456,8 +1455,7 @@ wordsBy predicate f m =
1456splitWithSuffix
1455splitWithSuffix
1457 :: (IsStream t, Monad m)
1456 :: (IsStream t, Monad m)
1458 => (a -> Bool) -> Fold m a b -> t m a -> t m b
1457 => (a -> Bool) -> Fold m a b -> t m a -> t m b
1459−splitWithSuffix predicate f m =
1458+splitWithSuffix predicate f = foldMany (FL.sliceEndWith predicate f)
1460− D.fromStreamD $ D.foldMany1 (FL.sliceEndWith predicate f) (D.toStreamD m)
1461
1459
1462------------------------------------------------------------------------------
1460------------------------------------------------------------------------------
1463-- Splitting - on a delimiter sequence
1461-- Splitting - on a delimiter sequence
src/Streamly/Internal/Data/Stream/StreamD/Type.hs+55−62
@@ -78,9 +78,9 @@ module Streamly.Internal.Data.Stream.StreamD.Type
78 , concatMap
78 , concatMap
79 , concatMapM
79 , concatMapM
80 , FoldMany (..) -- for inspection testing
80 , FoldMany (..) -- for inspection testing
81− , FoldMany1 (..)
81+ , FoldManyPost (..)
82 , foldMany
82 , foldMany
83− , foldMany1
83+ , foldManyPost
84 , groupsOf2
84 , groupsOf2
85 , chunksOf
85 , chunksOf
86 )
86 )
@@ -787,15 +787,14 @@ instance Monad m => Monad (Stream m) where
787------------------------------------------------------------------------------
787------------------------------------------------------------------------------
788
788
789-- s = stream state, fs = fold state
789-- s = stream state, fs = fold state
790−{-# ANN type FoldMany Fuse #-}
790+{-# ANN type FoldManyPost Fuse #-}
791−data FoldMany s fs b a
791+data FoldManyPost s fs b a
792− = FoldManyStart s
792+ = FoldManyPostStart s
793− | FoldManyLoop s fs
793+ | FoldManyPostLoop s fs
794− | FoldManyYield b (FoldMany s fs b a)
794+ | FoldManyPostYield b (FoldManyPost s fs b a)
795− | FoldManyDone
795+ | FoldManyPostDone
796−
796+
797−-- | This is the stream equivalent of "Data.Fold.Internal.many". The fold
797+-- | Like foldMany but with the following differences:
798−-- may consume 0 or more elements. It means:
799--
798--
800-- * If the stream is empty the default value of the fold would still be
799-- * If the stream is empty the default value of the fold would still be
801-- emitted in the output.
800-- emitted in the output.
@@ -803,10 +802,10 @@ data FoldMany s fs b a
803-- receive any input it would still yield the default fold accumulator as the
802-- receive any input it would still yield the default fold accumulator as the
804-- last value.
803-- last value.
805--
804--
806−{-# INLINE_NORMAL foldMany #-}
805+{-# INLINE_NORMAL foldManyPost #-}
807−foldMany :: Monad m => Fold m a b -> Stream m a -> Stream m b
806+foldManyPost :: Monad m => Fold m a b -> Stream m a -> Stream m b
808−foldMany (Fold fstep initial extract) (Stream step state) =
807+foldManyPost (Fold fstep initial extract) (Stream step state) =
809− Stream step' (FoldManyStart state)
808+ Stream step' (FoldManyPostStart state)
810
809
811 where
810 where
812
811
@@ -816,56 +815,50 @@ foldMany (Fold fstep initial extract) (Stream step state) =
816 return
815 return
817 $ Skip
816 $ Skip
818 $ case res of
817 $ case res of
819− FL.Done b -> FoldManyYield b (FoldManyStart s)
818+ FL.Done b -> FoldManyPostYield b (FoldManyPostStart s)
820− FL.Partial ps -> FoldManyLoop s ps
819+ FL.Partial ps -> FoldManyPostLoop s ps
821
820
822 {-# INLINE_LATE step' #-}
821 {-# INLINE_LATE step' #-}
823− step' _ (FoldManyStart st) = do
822+ step' _ (FoldManyPostStart st) = do
824 r <- initial
823 r <- initial
825 return
824 return
826 $ Skip
825 $ Skip
827 $ case r of
826 $ case r of
828− FL.Done b -> FoldManyYield b (FoldManyStart st)
827+ FL.Done b -> FoldManyPostYield b (FoldManyPostStart st)
829− FL.Partial fs -> FoldManyLoop st fs
828+ FL.Partial fs -> FoldManyPostLoop st fs
830− step' gst (FoldManyLoop st fs) = do
829+ step' gst (FoldManyPostLoop st fs) = do
831 r <- step (adaptState gst) st
830 r <- step (adaptState gst) st
832 case r of
831 case r of
833 Yield x s -> consume x s fs
832 Yield x s -> consume x s fs
834− Skip s -> return $ Skip (FoldManyLoop s fs)
833+ Skip s -> return $ Skip (FoldManyPostLoop s fs)
835 Stop -> do
834 Stop -> do
836 b <- extract fs
835 b <- extract fs
837− return $ Skip (FoldManyYield b FoldManyDone)
836+ return $ Skip (FoldManyPostYield b FoldManyPostDone)
838− step' _ (FoldManyYield b next) = return $ Yield b next
837+ step' _ (FoldManyPostYield b next) = return $ Yield b next
839− step' _ FoldManyDone = return Stop
838+ step' _ FoldManyPostDone = return Stop
840
839
841−{-# ANN type FoldMany1 Fuse #-}
840+{-# ANN type FoldMany Fuse #-}
842−data FoldMany1 s fs b a
841+data FoldMany s fs b a
843− = FoldMany1Start s
842+ = FoldManyStart s
844− | FoldMany1First fs s
843+ | FoldManyFirst fs s
845− | FoldMany1Loop s fs
844+ | FoldManyLoop s fs
846− | FoldMany1Yield b (FoldMany1 s fs b a)
845+ | FoldManyYield b (FoldMany s fs b a)
847− | FoldMany1Done
846+ | FoldManyDone
848
847
849−-- | Like 'foldMany' except that the fold consumes 1 or more elements. It
848+-- | Apply a fold multiple times until the stream ends. If the stream is empty
850−-- means:
849+-- the output would be empty.
851--
850--
852−-- * If the stream is empty the output would be empty.
853−-- * At the end of the stream if the last application of the fold did not
854−-- receive any input it would not result in any output.
855−--
856−-- @foldMany1 f = parseMany (fromFold f)@
851+-- @foldMany f = parseMany (fromFold f)@
857--
852--
858−-- This could be problematic unless we use an accumulator fold instead of a
859−-- terminating fold. A terminating fold may terminate even without accepting a
853+-- A terminating fold may terminate even without accepting a single input. So
860−-- single element. We can use parseMany instead where we can return the input
854+-- we run the fold's initial action before evaluating the stream. However, this
861−-- if the fold terminates without accepting any input. The alternative is to
855+-- means that if later the stream does not yield anything we have to discard
862−-- always execute the fold's initial action and discard it in case the stream
856+-- the fold's initial result which could have generated an effect.
863−-- stops without actually feeding input to it.
864--
857--
865−{-# INLINE_NORMAL foldMany1 #-}
858+{-# INLINE_NORMAL foldMany #-}
866−foldMany1 :: Monad m => Fold m a b -> Stream m a -> Stream m b
859+foldMany :: Monad m => Fold m a b -> Stream m a -> Stream m b
867−foldMany1 (Fold fstep initial extract) (Stream step state) =
860+foldMany (Fold fstep initial extract) (Stream step state) =
868− Stream step' (FoldMany1Start state)
861+ Stream step' (FoldManyStart state)
869
862
870 where
863 where
871
864
@@ -875,37 +868,37 @@ foldMany1 (Fold fstep initial extract) (Stream step state) =
875 return
868 return
876 $ Skip
869 $ Skip
877 $ case res of
870 $ case res of
878− FL.Done b -> FoldMany1Yield b (FoldMany1Start s)
871+ FL.Done b -> FoldManyYield b (FoldManyStart s)
879− FL.Partial ps -> FoldMany1Loop s ps
872+ FL.Partial ps -> FoldManyLoop s ps
880
873
881 {-# INLINE_LATE step' #-}
874 {-# INLINE_LATE step' #-}
882− step' _ (FoldMany1Start st) = do
875+ step' _ (FoldManyStart st) = do
883 r <- initial
876 r <- initial
884 return
877 return
885 $ Skip
878 $ Skip
886 $ case r of
879 $ case r of
887− FL.Done b -> FoldMany1Yield b (FoldMany1Start st)
880+ FL.Done b -> FoldManyYield b (FoldManyStart st)
888− FL.Partial fs -> FoldMany1First fs st
881+ FL.Partial fs -> FoldManyFirst fs st
889− step' gst (FoldMany1First fs st) = do
882+ step' gst (FoldManyFirst fs st) = do
890 r <- step (adaptState gst) st
883 r <- step (adaptState gst) st
891 case r of
884 case r of
892 Yield x s -> consume x s fs
885 Yield x s -> consume x s fs
893− Skip s -> return $ Skip (FoldMany1First fs s)
886+ Skip s -> return $ Skip (FoldManyFirst fs s)
894 Stop -> return Stop
887 Stop -> return Stop
895− step' gst (FoldMany1Loop st fs) = do
888+ step' gst (FoldManyLoop st fs) = do
896 r <- step (adaptState gst) st
889 r <- step (adaptState gst) st
897 case r of
890 case r of
898 Yield x s -> consume x s fs
891 Yield x s -> consume x s fs
899− Skip s -> return $ Skip (FoldMany1Loop s fs)
892+ Skip s -> return $ Skip (FoldManyLoop s fs)
900 Stop -> do
893 Stop -> do
901 b <- extract fs
894 b <- extract fs
902− return $ Skip (FoldMany1Yield b FoldMany1Done)
895+ return $ Skip (FoldManyYield b FoldManyDone)
903− step' _ (FoldMany1Yield b next) = return $ Yield b next
896+ step' _ (FoldManyYield b next) = return $ Yield b next
904− step' _ FoldMany1Done = return Stop
897+ step' _ FoldManyDone = return Stop
905
898
906{-# INLINE chunksOf #-}
899{-# INLINE chunksOf #-}
907chunksOf :: Monad m => Int -> Fold m a b -> Stream m a -> Stream m b
900chunksOf :: Monad m => Int -> Fold m a b -> Stream m a -> Stream m b
908−chunksOf n f = foldMany1 (FL.takeLE n f)
901+chunksOf n f = foldMany (FL.takeLE n f)
909
902
910data GroupState2 s fs
903data GroupState2 s fs
911 = GroupStart2 s
904 = GroupStart2 s