@@ -9,6 +9,7 @@
10import Prelude hiding (mapM)
10import Prelude hiding (mapM)
12+import Data.Function ((&))
12import Streamly.Prelude
13import Streamly.Prelude
13 ( SerialT, parallely, parallel, serially, maxBuffer, maxThreads)
14 ( SerialT, parallely, parallel, serially, maxBuffer, maxThreads)
@@ -57,6 +58,14 @@ parAppMap src = S.drain $ S.map (+1) S.|$ src
57parAppSum :: S.MonadAsync m => SerialT m Int -> m ()
58parAppSum :: S.MonadAsync m => SerialT m Int -> m ()
58parAppSum src = (S.sum S.|$. src) >>= \x -> seq x (return ())
59parAppSum src = (S.sum S.|$. src) >>= \x -> seq x (return ())
62+(|&) :: S.MonadAsync m => SerialT m Int -> m ()
63+(|&) src = src S.|& S.map (+ 1) & S.drain
66+(|&.) :: S.MonadAsync m => SerialT m Int -> m ()
67+(|&.) src = (src S.|&. S.sum) >>= \x -> seq x (return ())
60-------------------------------------------------------------------------------
69-------------------------------------------------------------------------------
62-------------------------------------------------------------------------------
71-------------------------------------------------------------------------------
@@ -79,6 +88,8 @@ o_1_space_merge_app_tap value =
79 -- Parallel stages in a pipeline
88 -- Parallel stages in a pipeline
80 , benchIOSink value "parAppMap" parAppMap
89 , benchIOSink value "parAppMap" parAppMap
81 , benchIOSink value "parAppSum" parAppSum
90 , benchIOSink value "parAppSum" parAppSum
91+ , benchIOSink value "(|&)" (|&)
92+ , benchIOSink value "(|&.)" (|&.)
82 , benchIOSink value "tapAsync" (tapAsync 1)
93 , benchIOSink value "tapAsync" (tapAsync 1)
83 , benchIOSink value "tapAsyncS" (tapAsyncS 1)
94 , benchIOSink value "tapAsyncS" (tapAsyncS 1)