@@ -23,6 +23,7 @@ import GHC.Exception (ErrorCall)
23import System.Random (randomRIO)
23import System.Random (randomRIO)
25import qualified Data.Foldable as F
25import qualified Data.Foldable as F
26+import qualified Data.List as List
26import qualified Streamly.Prelude as S
27import qualified Streamly.Prelude as S
27import qualified Streamly.Internal.Data.Stream.IsStream as Internal
28import qualified Streamly.Internal.Data.Stream.IsStream as Internal
28import qualified Streamly.Internal.Data.Pipe as Pipe
29import qualified Streamly.Internal.Data.Pipe as Pipe
@@ -287,6 +288,23 @@ sourceFoldMapWith :: (S.IsStream t, Semigroup (t m Int))
287 => Int -> Int -> t m Int
288 => Int -> Int -> t m Int
288sourceFoldMapWith value n = S.concatMapFoldableWith (<>) S.yield [n..n+value]
289sourceFoldMapWith value n = S.concatMapFoldableWith (<>) S.yield [n..n+value]
291+{-# INLINE concatForFoldableWith #-}
292+concatForFoldableWith :: (S.IsStream t, Semigroup (t m Int))
293+ => Int -> Int -> t m Int
294+concatForFoldableWith value n =
295+ S.concatForFoldableWith (<>) [n..n+value] S.yield
297+{-# INLINE concatFoldableWith #-}
298+concatFoldableWith :: (S.IsStream t, Semigroup (t m Int))
299+ => Int -> Int -> t m Int
300+concatFoldableWith value n =
303+ then Just (S.yield x, x + 1)
305+ list = List.unfoldr step n
306+ in S.concatFoldableWith (<>) list
290{-# INLINE sourceFoldMapWithStream #-}
308{-# INLINE sourceFoldMapWithStream #-}
291sourceFoldMapWithStream :: (S.IsStream t, Semigroup (t m Int))
309sourceFoldMapWithStream :: (S.IsStream t, Semigroup (t m Int))
292 => Int -> Int -> t m Int
310 => Int -> Int -> t m Int