@@ -35,6 +35,7 @@ module Streamly.Internal.Data.Stream.Async
37 , constRate
37 , constRate
39 -- * Combinators
40 -- * Combinators
40 -- | Stream combinators using Async channel
41 -- | Stream combinators using Async channel
@@ -55,6 +56,7 @@ module Streamly.Internal.Data.Stream.Async
55 , interleaveWith
56 , interleaveWith
58 , concatList
60 , concatList
60 , concatWith
62 , concatWith
@@ -284,10 +286,21 @@ concat = concatWith id
284concatList :: MonadAsync m => [Stream m a] -> Stream m a
286concatList :: MonadAsync m => [Stream m a] -> Stream m a
285concatList = concat . Stream.fromList
287concatList = concat . Stream.fromList
289+{-# INLINE applyWith #-}
290+{-# SPECIALIZE applyWith ::
291+ (Config -> Config) -> Stream IO (a -> b) -> Stream IO a -> Stream IO b #-}
292+applyWith :: MonadAsync m =>
293+ (Config -> Config) -> Stream m (a -> b) -> Stream m a -> Stream m b
294+applyWith modifier stream1 stream2 =
297+ (\g -> concatMapWith modifier (pure . g) stream2)
287{-# INLINE apply #-}
300{-# INLINE apply #-}
288{-# SPECIALIZE apply :: Stream IO (a -> b) -> Stream IO a -> Stream IO b #-}
301{-# SPECIALIZE apply :: Stream IO (a -> b) -> Stream IO a -> Stream IO b #-}
289apply :: MonadAsync m => Stream m (a -> b) -> Stream m a -> Stream m b
302apply :: MonadAsync m => Stream m (a -> b) -> Stream m a -> Stream m b
290−apply stream1 stream2 = concatMap (\g -> concatMap (pure . g) stream2) stream1
303+apply = applyWith id
293-- >>> mapMWith modifier f = Async.concatMapWith modifier (Stream.fromEffect . f)
306-- >>> mapMWith modifier f = Async.concatMapWith modifier (Stream.fromEffect . f)