on master help sign in
Use conventional style signature for withChannel
c60b704Harendra Kumar
src/Streamly/Internal/Data/Stream/Concurrent.hs+3−3
@@ -148,7 +148,7 @@ evalWithD modifier m = D.Stream step Nothing
148--
148--
149{-# INLINE evalWith #-}
149{-# INLINE evalWith #-}
150evalWith :: MonadAsync m => (Config -> Config) -> Stream m a -> Stream m a
150evalWith :: MonadAsync m => (Config -> Config) -> Stream m a -> Stream m a
151−evalWith = withChannel (const id)
151+evalWith modifier input = withChannel modifier input (const id)
152 -- Stream.fromStreamD $ evalWithD cfg $ Stream.toStreamD stream
152 -- Stream.fromStreamD $ evalWithD cfg $ Stream.toStreamD stream
153
153
154-- | Evaluate a stream asynchronously using a channel and serve the consumer
154-- | Evaluate a stream asynchronously using a channel and serve the consumer
@@ -390,9 +390,9 @@ concatMapWithChanKGeneric modifier chan f stream = do
390{-# INLINE concatMapWithK #-}
390{-# INLINE concatMapWithK #-}
391concatMapWithK :: MonadAsync m =>
391concatMapWithK :: MonadAsync m =>
392 (Config -> Config) -> (a -> K.Stream m b) -> K.Stream m a -> K.Stream m b
392 (Config -> Config) -> (a -> K.Stream m b) -> K.Stream m a -> K.Stream m b
393−concatMapWithK modifier f =
393+concatMapWithK modifier f input =
394 let g = concatMapWithChanKGeneric modifier
394 let g = concatMapWithChanKGeneric modifier
395− in withChannelK (`g` f) modifier
395+ in withChannelK modifier input (`g` f)
396
396
397-- concatMapWith modifier f stream = concatWith modifier $ fmap f stream
397-- concatMapWith modifier f stream = concatWith modifier $ fmap f stream
398
398
src/Streamly/Internal/Data/Stream/Concurrent/Channel.hs+7−7
@@ -79,11 +79,11 @@ newChannel modifier =
79-- supplied evaluator function. The evaluator is run in a worker thread.
79-- supplied evaluator function. The evaluator is run in a worker thread.
80{-# INLINE withChannelK #-}
80{-# INLINE withChannelK #-}
81withChannelK :: MonadAsync m =>
81withChannelK :: MonadAsync m =>
82− (Channel m b -> K.Stream m a -> K.Stream m b)
83− -> (Config -> Config)
82+ (Config -> Config)
84 -> K.Stream m a
83 -> K.Stream m a
84+ -> (Channel m b -> K.Stream m a -> K.Stream m b)
85 -> K.Stream m b
85 -> K.Stream m b
86−withChannelK evaluator modifier input = K.concatEffect action
86+withChannelK modifier input evaluator = K.concatEffect action
87
87
88 where
88 where
89
89
@@ -96,10 +96,10 @@ withChannelK evaluator modifier input = K.concatEffect action
96-- supplied evaluator function. The evaluator is run in a worker thread.
96-- supplied evaluator function. The evaluator is run in a worker thread.
97{-# INLINE withChannel #-}
97{-# INLINE withChannel #-}
98withChannel :: MonadAsync m =>
98withChannel :: MonadAsync m =>
99− (Channel m b -> Stream m a -> Stream m b)
100− -> (Config -> Config)
99+ (Config -> Config)
101 -> Stream m a
100 -> Stream m a
101+ -> (Channel m b -> Stream m a -> Stream m b)
102 -> Stream m b
102 -> Stream m b
103−withChannel evaluator modifier input =
103+withChannel modifier input evaluator =
104 let f chan stream = toStreamK $ evaluator chan (fromStreamK stream)
104 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