on master help sign in
Change the argument order in "many"
7910e05Harendra Kumar
benchmark/Streamly/Benchmark/Data/Fold.hs+1−1
@@ -88,7 +88,7 @@ takeEndBy_ value = IP.fold (FL.takeEndBy_ (>= value) FL.drain)
88
88
89{-# INLINE many #-}
89{-# INLINE many #-}
90many :: Monad m => SerialT m Int -> m ()
90many :: Monad m => SerialT m Int -> m ()
91−many = IP.fold (FL.many FL.drain (FL.take 1 FL.drain))
91+many = IP.fold (FL.many (FL.take 1 FL.drain) FL.drain)
92
92
93{-# INLINE splitAllAny #-}
93{-# INLINE splitAllAny #-}
94splitAllAny :: Monad m => Int -> SerialT m Int -> m (Bool, Bool)
94splitAllAny :: Monad m => Int -> SerialT m Int -> m (Bool, Bool)
src/Streamly/Internal/Data/Fold/Types.hs+7−9
@@ -902,9 +902,7 @@ runStep (Fold step initial extract) a = return $ Fold step initial1 extract
902-- applied to a fold input stream. groupBy et al can be written as terminating
902-- applied to a fold input stream. groupBy et al can be written as terminating
903-- folds and then we can apply "many" to use those repeatedly on a stream.
903-- folds and then we can apply "many" to use those repeatedly on a stream.
904
904
905−-- XXXX flip the order of arguments
906−--
907−-- | Collect zero or more applications of a fold. @many collect split@ applies
905+-- | Collect zero or more applications of a fold. @many split collect@ applies
908-- the @split@ fold repeatedly on the input stream and accumulates zero or more
906-- the @split@ fold repeatedly on the input stream and accumulates zero or more
909-- fold results using @collect@.
907-- fold results using @collect@.
910--
908--
@@ -915,8 +913,8 @@ runStep (Fold step initial extract) a = return $ Fold step initial1 extract
915-- /See also: Streamly.Prelude.concatMap, Streamly.Prelude.foldMany/
913-- /See also: Streamly.Prelude.concatMap, Streamly.Prelude.foldMany/
916--
914--
917{-# INLINE many #-}
915{-# INLINE many #-}
918−many :: Monad m => Fold m b c -> Fold m a b -> Fold m a c
916+many :: Monad m => Fold m a b -> Fold m b c -> Fold m a c
919−many (Fold cstep cinitial cextract) (Fold sstep sinitial sextract) =
917+many (Fold sstep sinitial sextract) (Fold cstep cinitial cextract) =
920 Fold step initial extract
918 Fold step initial extract
921
919
922 where
920 where
@@ -966,7 +964,7 @@ many (Fold cstep cinitial cextract) (Fold sstep sinitial sextract) =
966-- of @n@ items in the input stream and supplies the result to the @collect@
964-- of @n@ items in the input stream and supplies the result to the @collect@
967-- fold.
965-- fold.
968--
966--
969−-- > chunksOf n split collect = many collect (take n split)
967+-- > chunksOf n split = many (take n split)
970--
968--
971-- Stops when @collect@ stops.
969-- Stops when @collect@ stops.
972--
970--
@@ -974,7 +972,7 @@ many (Fold cstep cinitial cextract) (Fold sstep sinitial sextract) =
974--
972--
975{-# INLINE chunksOf #-}
973{-# INLINE chunksOf #-}
976chunksOf :: Monad m => Int -> Fold m a b -> Fold m b c -> Fold m a c
974chunksOf :: Monad m => Int -> Fold m a b -> Fold m b c -> Fold m a c
977−chunksOf n split collect = many collect (take n split)
975+chunksOf n split = many (take n split)
978
976
979-- |
977-- |
980--
978--
@@ -1079,10 +1077,10 @@ takeInterval n (Fold step initial done) = Fold step' initial' done'
1079--
1077--
1080-- @
1078-- @
1081--
1079--
1082−-- > intervalsOf n split collect = many collect (takeInterval n split)
1080+-- > intervalsOf n split = many (takeInterval n split)
1083--
1081--
1084-- /Pre-release/
1082-- /Pre-release/
1085--
1083--
1086{-# INLINE intervalsOf #-}
1084{-# INLINE intervalsOf #-}
1087intervalsOf :: MonadAsync m => Double -> Fold m a b -> Fold m b c -> Fold m a c
1085intervalsOf :: MonadAsync m => Double -> Fold m a b -> Fold m b c -> Fold m a c
1088−intervalsOf n split collect = many collect (takeInterval n split)
1086+intervalsOf n split = many (takeInterval n split)