@@ -43,8 +43,8 @@ module Streamly.Streams
4343 , mkAsync
4444 , (|$)
4545 , (|&)
46− , (|>)
47− , (<|)
46+ , (|$.)
47+ , (|&.)
4848
4949 -- * Merging Streams
5050 , serial
@@ -54,6 +54,7 @@ module Streamly.Streams
5454 , wAsync
5555 , parallel
5656 , (<=>) --deprecated
57+ , (<|) --deprecated
5758
5859 -- * IO Streams
5960 , Serial
@@ -330,6 +331,12 @@ runWith :: (IsStream t, MonadAsync m)
330331 => SVarStyle -> (t m a -> m b) -> t m a -> m b
331332runWith style f x = S.runWith style (f . fromStream) (toStream x)
332333
334+infixr 0 |$
335+infixr 0 |$.
336+
337+infixl 1 |&
338+infixl 1 |&.
339+
333340-- | Parallel function application operator for streams; just like the regular
334341-- function application operator '$' except that it is concurrent. The
335342-- following code prints a value every second even though each stage adds a 1
@@ -369,34 +376,35 @@ x |& f = f |$ x
369376-- | Parallel function application operator; applies a @run@ or @fold@ function
370377-- to a stream such that the fold consumer and the stream producer run in
371378-- parallel. A @run@ or @fold@ function reduces the stream to a value in the
372−-- underlying monad.
379+-- underlying monad. The @.@ at the end of the operator is a mnemonic for
380+-- termination of the stream.
373381--
374382-- @
375383-- S.foldlM' (\\_ a -> threadDelay 1000000 >> print a) ()
376−-- <| S.repeatM (threadDelay 1000000 >> return 1)
384+-- |$. S.repeatM (threadDelay 1000000 >> return 1)
377385-- @
378386--
379387-- /Concurrent/
380388--
381389-- @since 0.3.0
382−{-# INLINE (<|) #-}
383−(<|) :: (IsStream t, MonadAsync m) => (t m a -> m b) -> t m a -> m b
384−f <| x = runWith ParallelVar f x
390+{-# INLINE (|$.) #-}
391+(|$.) :: (IsStream t, MonadAsync m) => (t m a -> m b) -> t m a -> m b
392+f |$. x = runWith ParallelVar f x
385393
386394-- | Parallel reverse function application operator for applying a run or fold
387−-- functions to a stream. Just like '<|' except that the operands are reversed.
395+-- functions to a stream. Just like '|$.' except that the operands are reversed.
388396--
389397-- @
390−-- S.repeatM (threadDelay 1000000 >> return 1)
391−-- |> S.foldlM' (\\_ a -> threadDelay 1000000 >> print a) ()
398+-- S.repeatM (threadDelay 1000000 >> return 1)
399+-- |&. S.foldlM' (\\_ a -> threadDelay 1000000 >> print a) ()
392400-- @
393401--
394402-- /Concurrent/
395403--
396404-- @since 0.3.0
397−{-# INLINE (|>) #-}
398−(|>) :: (IsStream t, MonadAsync m) => t m a -> (t m a -> m b) -> m b
399−x |> f = f <| x
405+{-# INLINE (|&.) #-}
406+(|&.) :: (IsStream t, MonadAsync m) => t m a -> (t m a -> m b) -> m b
407+x |&. f = f |$. x
400408
401409------------------------------------------------------------------------------
402410-- CPP macros for common instances
@@ -884,6 +892,14 @@ instance IsStream AsyncT where
884892async :: (IsStream t, MonadAsync m) => t m a -> t m a -> t m a
885893async m1 m2 = fromStream $ S.async (toStream m1) (toStream m2)
886894
895+-- | Same as 'async'.
896+--
897+-- @since 0.1.0
898+{-# DEPRECATED (<|) "Please use 'async' instead." #-}
899+{-# INLINE (<|) #-}
900+(<|) :: (IsStream t, MonadAsync m) => t m a -> t m a -> t m a
901+(<|) = async
902+
887903instance MonadAsync m => Semigroup (AsyncT m a) where
888904 (<>) = async
889905