@@ -51,13 +51,17 @@ module Streamly.Internal.Data.Stream.Concurrent
51 , evalWith
51 , evalWith
52 -- Add unfoldrM/iterateM?
52 -- Add unfoldrM/iterateM?
55+ -- | Uses a single channel to evaluate all actions.
55 -- | Uses a single channel to evaluate all actions.
60 -- | Uses a single channel to evaluate all actions.
57 , mapMWith
62 , mapMWith
58 , sequence
63 , sequence
59 , sequenceWith
64 , sequenceWith
60− -- Add repeatM/replicateM?
62 -- ** Combine two
66 -- ** Combine two
63 -- | Use a channel for each pair.
67 -- | Use a channel for each pair.
@@ -655,6 +659,27 @@ zipWith :: MonadAsync m
655 => (a -> b -> c) -> Stream m a -> Stream m b -> Stream m c
659 => (a -> b -> c) -> Stream m a -> Stream m b -> Stream m c
656zipWith f = zipWithM (\a b -> return $ f a b)
660zipWith f = zipWithM (\a b -> return $ f a b)
662+-------------------------------------------------------------------------------
664+-------------------------------------------------------------------------------
667+-- >>> repeatM = Concur.sequence . Stream.repeat
669+-- Generate a stream by repeatedly executing a monadic action forever. The
670+-- number of actions that are executed concurrently is limited by 'maxThreads'.
671+{-# INLINE repeatM #-}
672+repeatM :: MonadAsync m => m a -> Stream m a
673+repeatM = sequence . Stream.repeat
676+-- >>> replicateM n = Concur.sequence . Stream.replicate n
678+-- Generate a stream by concurrently performing a monadic action @n@ times.
679+{-# INLINE replicateM #-}
680+replicateM :: MonadAsync m => Int -> m a -> Stream m a
681+replicateM n = sequence . Stream.replicate n
658-------------------------------------------------------------------------------
683-------------------------------------------------------------------------------
659-- Reactive
684-- Reactive
660-------------------------------------------------------------------------------
685-------------------------------------------------------------------------------