on master help sign in
Rename merge to tee
commit98d225672dbdb2f510fecd72cddb4f4af1c21fc4 authorHarendra Kumar <harendra.kumar@gmail.com> dateFri 7 Jun 2019, 09:06 (7 years ago) parent517c3b7
4 files changed+13−13
benchmark/Linear.hs+2−2 benchmark/LinearOps.hs+4−4 src/Streamly/Pipe.hs+2−2 src/Streamly/Pipe/Types.hs+5−5
benchmark/Linear.hs+2−2
@@ -246,13 +246,13 @@ main =
246246 , bgroup "pipes"
247247 [ benchIOSink "mapM" (Ops.transformMapM serially 1)
248248 , benchIOSink "compose" (Ops.transformComposeMapM serially 1)
249− , benchIOSink "merge" (Ops.transformMergeMapM serially 1)
249+ , benchIOSink "tee" (Ops.transformTeeMapM serially 1)
250250 , benchIOSink "zip" (Ops.transformZipMapM serially 1)
251251 ]
252252 , bgroup "pipesX4"
253253 [ benchIOSink "mapM" (Ops.transformMapM serially 4)
254254 , benchIOSink "compose" (Ops.transformComposeMapM serially 4)
255− , benchIOSink "merge" (Ops.transformMergeMapM serially 4)
255+ , benchIOSink "tee" (Ops.transformTeeMapM serially 4)
256256 , benchIOSink "zip" (Ops.transformZipMapM serially 4)
257257 ]
258258 , bgroup "transformation"
benchmark/LinearOps.hs+4−4
@@ -362,11 +362,11 @@ mapMaybeM :: S.MonadAsync m => Int -> Stream m Int -> m ()
362362{-# INLINE mapM #-}
363363{-# INLINE transformMapM #-}
364364{-# INLINE transformComposeMapM #-}
365−{-# INLINE transformMergeMapM #-}
365+{-# INLINE transformTeeMapM #-}
366366{-# INLINE transformZipMapM #-}
367367{-# INLINE map' #-}
368368{-# INLINE fmap' #-}
369−mapM, map', transformMapM, transformComposeMapM, transformMergeMapM,
369+mapM, map', transformMapM, transformComposeMapM, transformTeeMapM,
370370 transformZipMapM :: (S.IsStream t, S.MonadAsync m)
371371 => (t m Int -> S.SerialT m Int) -> Int -> t m Int -> m ()
372372
@@ -389,9 +389,9 @@ transformMapM t n = composeN' n $ t . S.transform (Pipe.mapM return)
389389transformComposeMapM t n = composeN' n $ t . S.transform
390390 (Pipe.mapM (\x -> return (x + 1))
391391 `Pipe.compose` Pipe.mapM (\x -> return (x + 2)))
392−transformMergeMapM t n = composeN' n $ t . S.transform
392+transformTeeMapM t n = composeN' n $ t . S.transform
393393 (Pipe.mapM (\x -> return (x + 1))
394− `Pipe.merge` Pipe.mapM (\x -> return (x + 2)))
394+ `Pipe.tee` Pipe.mapM (\x -> return (x + 2)))
395395transformZipMapM t n = composeN' n $ t . S.transform
396396 (Pipe.zipWith (+) (Pipe.mapM (\x -> return (x + 1)))
397397 (Pipe.mapM (\x -> return (x + 2))))
src/Streamly/Pipe.hs+2−2
@@ -121,7 +121,7 @@ module Streamly.Pipe
121121 -}
122122
123123 -- * Composing Pipes
124− , merge
124+ , tee
125125 , zipWith
126126 , compose
127127
@@ -253,7 +253,7 @@ import Prelude
253253-- import Streamly (MonadAsync, parallel)
254254-- import Streamly.Fold.Types (Fold(..))
255255import Streamly.Pipe.Types
256− (Pipe(..), PipeState(..), Step(..), zipWith, merge, map, compose)
256+ (Pipe(..), PipeState(..), Step(..), zipWith, tee, map, compose)
257257-- import Streamly.Mem.Array.Types (Array)
258258-- import Streamly.Mem.Ring (Ring)
259259-- import Streamly.Streams.Serial (SerialT)
src/Streamly/Pipe/Types.hs+5−5
@@ -16,7 +16,7 @@ module Streamly.Pipe.Types
1616 , Pipe (..)
1717 , PipeState (..)
1818 , zipWith
19− , merge
19+ , tee
2020 , map
2121 , compose
2222 )
@@ -259,9 +259,9 @@ instance Monad m => Applicative (Pipe m a) where
259259-- merges the outputs of the two.
260260--
261261-- @since 0.7.0
262−{-# INLINE_NORMAL merge #-}
263−merge :: Monad m => Pipe m a b -> Pipe m a b -> Pipe m a b
264−merge (Pipe consumeL produceL stateL) (Pipe consumeR produceR stateR) =
262+{-# INLINE_NORMAL tee #-}
263+tee :: Monad m => Pipe m a b -> Pipe m a b -> Pipe m a b
264+tee (Pipe consumeL produceL stateL) (Pipe consumeR produceR stateR) =
265265 Pipe consume produce state
266266 where
267267
@@ -324,7 +324,7 @@ merge (Pipe consumeL produceL stateL) (Pipe consumeR produceR stateR) =
324324
325325instance Monad m => Semigroup (Pipe m a b) where
326326 {-# INLINE (<>) #-}
327− (<>) = merge
327+ (<>) = tee
328328
329329-- | Lift a pure function to a 'Pipe'.
330330--