on master help sign in
Expose tapAsync via internal module
7e853faHarendra Kumar
src/Streamly/Internal.hs+4
@@ -15,8 +15,12 @@
15module Streamly.Internal
15module Streamly.Internal
16 ( Fold (..)
16 ( Fold (..)
17 , inspectMode
17 , inspectMode
18+
19+ -- * Streamly.Prelude
20+ , tapAsync
18 )
21 )
19where
22where
20
23
21import Streamly.Fold.Types (Fold(..))
24import Streamly.Fold.Types (Fold(..))
22import Streamly.Streams.Combinators (inspectMode)
25import Streamly.Streams.Combinators (inspectMode)
26+import Streamly.Streams.Parallel (tapAsync)
src/Streamly/Prelude.hs−1
@@ -537,7 +537,6 @@ module Streamly.Prelude
537 -- ** Distributing
537 -- ** Distributing
538 , trace
538 , trace
539 , tap
539 , tap
540− , Par.tee
541
540
542 {-
541 {-
543 -- * Windowed Classification
542 -- * Windowed Classification
src/Streamly/Streams/Parallel.hs+5−5
@@ -25,7 +25,7 @@ module Streamly.Streams.Parallel
25 , parallel
25 , parallel
26 , parallelEndByFirst
26 , parallelEndByFirst
27 , parallelEndByAny
27 , parallelEndByAny
28− , tee
28+ , tapAsync
29
29
30 -- * Function application
30 -- * Function application
31 , mkParallel
31 , mkParallel
@@ -267,7 +267,7 @@ handleChildException _sv e = do
267-- @
267-- @
268--
268--
269-- @
269-- @
270−-- > S.drain $ S.tee (S.mapM_ print) (S.enumerateFromTo 1 2)
270+-- > S.drain $ S.tapAsync (S.mapM_ print) (S.enumerateFromTo 1 2)
271-- 1
271-- 1
272-- 2
272-- 2
273-- @
273-- @
@@ -282,9 +282,9 @@ handleChildException _sv e = do
282-- Compare with 'tap'.
282-- Compare with 'tap'.
283--
283--
284-- @since 0.7.0
284-- @since 0.7.0
285−{-# INLINE tee #-}
285+{-# INLINE tapAsync #-}
286−tee :: (IsStream t, MonadAsync m) => (t m a -> m b) -> t m a -> t m a
286+tapAsync :: (IsStream t, MonadAsync m) => (t m a -> m b) -> t m a -> t m a
287−tee f m = mkStream $ \st yld sng stp -> do
287+tapAsync f m = mkStream $ \st yld sng stp -> do
288 -- Buffer size for the SVar is derived from the current state
288 -- Buffer size for the SVar is derived from the current state
289 sv <- newParallelVar StopNone (adaptState st)
289 sv <- newParallelVar StopNone (adaptState st)
290 -- XXX exception handling
290 -- XXX exception handling