on master help sign in
Use conventional style signature for withChannel
commitc60b70472da3114f0f01f94901d20fbdc120f49d authorHarendra Kumar <harendra@composewell.com> dateSat 15 Oct 2022, 16:13 (4 years ago) parentee2fd69
2 files changed+10−10
src/Streamly/Internal/Data/Stream/Concurrent.hs+3−3 src/Streamly/Internal/Data/Stream/Concurrent/Channel.hs+7−7
src/Streamly/Internal/Data/Stream/Concurrent.hs+3−3
@@ -148,7 +148,7 @@ evalWithD modifier m = D.Stream step Nothing
148148--
149149{-# INLINE evalWith #-}
150150evalWith :: MonadAsync m => (Config -> Config) -> Stream m a -> Stream m a
151−evalWith = withChannel (const id)
151+evalWith modifier input = withChannel modifier input (const id)
152152 -- Stream.fromStreamD $ evalWithD cfg $ Stream.toStreamD stream
153153
154154-- | Evaluate a stream asynchronously using a channel and serve the consumer
@@ -390,9 +390,9 @@ concatMapWithChanKGeneric modifier chan f stream = do
390390{-# INLINE concatMapWithK #-}
391391concatMapWithK :: MonadAsync m =>
392392 (Config -> Config) -> (a -> K.Stream m b) -> K.Stream m a -> K.Stream m b
393−concatMapWithK modifier f =
393+concatMapWithK modifier f input =
394394 let g = concatMapWithChanKGeneric modifier
395− in withChannelK (`g` f) modifier
395+ in withChannelK modifier input (`g` f)
396396
397397-- concatMapWith modifier f stream = concatWith modifier $ fmap f stream
398398
src/Streamly/Internal/Data/Stream/Concurrent/Channel.hs+7−7
@@ -79,11 +79,11 @@ newChannel modifier =
7979-- supplied evaluator function. The evaluator is run in a worker thread.
8080{-# INLINE withChannelK #-}
8181withChannelK :: MonadAsync m =>
82− (Channel m b -> K.Stream m a -> K.Stream m b)
83− -> (Config -> Config)
82+ (Config -> Config)
8483 -> K.Stream m a
84+ -> (Channel m b -> K.Stream m a -> K.Stream m b)
8585 -> K.Stream m b
86−withChannelK evaluator modifier input = K.concatEffect action
86+withChannelK modifier input evaluator = K.concatEffect action
8787
8888 where
8989
@@ -96,10 +96,10 @@ withChannelK evaluator modifier input = K.concatEffect action
9696-- supplied evaluator function. The evaluator is run in a worker thread.
9797{-# INLINE withChannel #-}
9898withChannel :: MonadAsync m =>
99− (Channel m b -> Stream m a -> Stream m b)
100− -> (Config -> Config)
99+ (Config -> Config)
101100 -> Stream m a
101+ -> (Channel m b -> Stream m a -> Stream m b)
102102 -> Stream m b
103−withChannel evaluator modifier input =
103+withChannel modifier input evaluator =
104104 let f chan stream = toStreamK $ evaluator chan (fromStreamK stream)
105− in fromStreamK $ withChannelK f modifier (toStreamK input)
105+ in fromStreamK $ withChannelK modifier (toStreamK input) f