on master help sign in
Name parList style combinators more explicitly
38c7672Harendra Kumar
src/Streamly/Data/Stream/Concurrent.hs+1−1
@@ -78,7 +78,7 @@ module Streamly.Data.Stream.Concurrent
78 -- , append
78 -- , append
79 -- , ahead
79 -- , ahead
80 -- , parallel
80 -- , parallel
81− , parConcatList
81+ , parList
82 -- , parallelFst
82 -- , parallelFst
83 -- , parallelMin
83 -- , parallelMin
84 -- , zipWithM
84 -- , zipWithM
src/Streamly/Internal/Data/Stream/Concurrent.hs+40−40
@@ -73,13 +73,13 @@ module Streamly.Internal.Data.Stream.Concurrent
73
73
74 -- ** List of streams
74 -- ** List of streams
75 -- | Shares a single channel across many streams.
75 -- | Shares a single channel across many streams.
76− , parLazy
76+ , parListLazy
77− , parLazyOrdered
77+ , parListOrdered
78− , parLazyInterleaved
78+ , parListInterleaved
79− , parEager
79+ , parListEager
80− , parEagerFst
80+ , parListEagerFst
81− , parEagerMin
81+ , parListEagerMin
82− , parConcatList
82+ , parList
83
83
84 , parZipWithM
84 , parZipWithM
85 , parZipWith
85 , parZipWith
@@ -492,64 +492,64 @@ parConcat modifier = parConcatMap modifier id
492
492
493-- | Like 'parConcat' but works on a list of streams.
493-- | Like 'parConcat' but works on a list of streams.
494--
494--
495−-- >>> parConcatList modifier = Stream.parConcat modifier . Stream.fromList
495+-- >>> parList modifier = Stream.parConcat modifier . Stream.fromList
496--
496--
497−{-# INLINE parConcatList #-}
497+{-# INLINE parList #-}
498−parConcatList :: MonadAsync m => (Config -> Config) -> [Stream m a] -> Stream m a
498+parList :: MonadAsync m => (Config -> Config) -> [Stream m a] -> Stream m a
499−parConcatList modifier = parConcat modifier . Stream.fromList
499+parList modifier = parConcat modifier . Stream.fromList
500
500
501-- | Like 'concat' but works on a list of streams.
501-- | Like 'concat' but works on a list of streams.
502--
502--
503−-- >>> parLazy = Stream.parConcatList id
503+-- >>> parListLazy = Stream.parList id
504--
504--
505−{-# INLINE parLazy #-}
505+{-# INLINE parListLazy #-}
506−parLazy :: MonadAsync m => [Stream m a] -> Stream m a
506+parListLazy :: MonadAsync m => [Stream m a] -> Stream m a
507−parLazy = parConcatList id
507+parListLazy = parList id
508
508
509−-- | Like 'parLazy' but interleaves the streams fairly instead of prioritizing
509+-- | Like 'parListLazy' but interleaves the streams fairly instead of prioritizing
510-- the left stream. This schedules all streams in a round robin fashion over
510-- the left stream. This schedules all streams in a round robin fashion over
511-- limited number of threads.
511-- limited number of threads.
512--
512--
513−-- >>> parLazyInterleaved = Stream.parConcatList (Stream.interleaved True)
513+-- >>> parListInterleaved = Stream.parList (Stream.interleaved True)
514--
514--
515−{-# INLINE parLazyInterleaved #-}
515+{-# INLINE parListInterleaved #-}
516−parLazyInterleaved :: MonadAsync m => [Stream m a] -> Stream m a
516+parListInterleaved :: MonadAsync m => [Stream m a] -> Stream m a
517−parLazyInterleaved = parConcatList (interleaved True)
517+parListInterleaved = parList (interleaved True)
518
518
519−-- | Like 'parLazy' but with 'ordered' on.
519+-- | Like 'parListLazy' but with 'ordered' on.
520--
520--
521−-- >>> parLazyOrdered = Stream.parConcatList (Stream.ordered True)
521+-- >>> parListOrdered = Stream.parList (Stream.ordered True)
522--
522--
523−{-# INLINE parLazyOrdered #-}
523+{-# INLINE parListOrdered #-}
524−parLazyOrdered :: MonadAsync m => [Stream m a] -> Stream m a
524+parListOrdered :: MonadAsync m => [Stream m a] -> Stream m a
525−parLazyOrdered = parConcatList (ordered True)
525+parListOrdered = parList (ordered True)
526
526
527−-- | Like 'parLazy' but with 'eager' on.
527+-- | Like 'parListLazy' but with 'eager' on.
528--
528--
529−-- >>> parEager = Stream.parConcatList (Stream.eager True)
529+-- >>> parListEager = Stream.parList (Stream.eager True)
530--
530--
531−{-# INLINE parEager #-}
531+{-# INLINE parListEager #-}
532−parEager :: MonadAsync m => [Stream m a] -> Stream m a
532+parListEager :: MonadAsync m => [Stream m a] -> Stream m a
533−parEager = parConcatList (eager True)
533+parListEager = parList (eager True)
534
534
535−-- | Like 'parEager' but stops the output as soon as the first stream stops.
535+-- | Like 'parListEager' but stops the output as soon as the first stream stops.
536--
536--
537−-- >>> parEagerFst = Stream.parConcatList (Stream.eager True . Stream.stopWhen Stream.FirstStops)
537+-- >>> parListEagerFst = Stream.parList (Stream.eager True . Stream.stopWhen Stream.FirstStops)
538--
538--
539−{-# INLINE parEagerFst #-}
539+{-# INLINE parListEagerFst #-}
540−parEagerFst :: MonadAsync m => [Stream m a] -> Stream m a
540+parListEagerFst :: MonadAsync m => [Stream m a] -> Stream m a
541−parEagerFst = parConcatList (eager True . stopWhen FirstStops)
541+parListEagerFst = parList (eager True . stopWhen FirstStops)
542
542
543−-- | Like 'parEager' but stops the output as soon as any of the two streams
543+-- | Like 'parListEager' but stops the output as soon as any of the two streams
544-- stops.
544-- stops.
545--
545--
546-- Definition:
546-- Definition:
547--
547--
548−-- >>> parEagerMin = Stream.parConcatList (Stream.eager True . Stream.stopWhen Stream.AnyStops)
548+-- >>> parListEagerMin = Stream.parList (Stream.eager True . Stream.stopWhen Stream.AnyStops)
549--
549--
550−{-# INLINE parEagerMin #-}
550+{-# INLINE parListEagerMin #-}
551−parEagerMin :: MonadAsync m => [Stream m a] -> Stream m a
551+parListEagerMin :: MonadAsync m => [Stream m a] -> Stream m a
552−parEagerMin = parConcatList (eager True . stopWhen AnyStops)
552+parListEagerMin = parList (eager True . stopWhen AnyStops)
553
553
554-------------------------------------------------------------------------------
554-------------------------------------------------------------------------------
555-- Applicative
555-- Applicative
src/Streamly/Internal/Data/Stream/Time.hs+3−3
@@ -98,7 +98,7 @@ import Streamly.Internal.Data.Stream.Concurrent
98-- >>> import qualified Streamly.Data.Stream as Stream
98-- >>> import qualified Streamly.Data.Stream as Stream
99-- >>> import qualified Streamly.Data.Stream.Prelude as Stream
99-- >>> import qualified Streamly.Data.Stream.Prelude as Stream
100-- >>> import qualified Streamly.Internal.Data.Stream as Stream (delayPost, timestamped)
100-- >>> import qualified Streamly.Internal.Data.Stream as Stream (delayPost, timestamped)
101−-- >>> import qualified Streamly.Internal.Data.Stream.Concurrent as Stream (parEagerFst)
101+-- >>> import qualified Streamly.Internal.Data.Stream.Concurrent as Stream (parListEagerFst)
102-- >>> import qualified Streamly.Internal.Data.Stream.Time as Stream
102-- >>> import qualified Streamly.Internal.Data.Stream.Time as Stream
103-- >>> import Prelude hiding (concatMap, concat)
103-- >>> import Prelude hiding (concatMap, concat)
104-- >>> :{
104-- >>> :{
@@ -154,7 +154,7 @@ ticksRate r = parEval (rate (Just r)) $ Stream.repeatM (return ())
154--
154--
155-- Definition:
155-- Definition:
156--
156--
157−-- >>> interject n f xs = Stream.parEagerFst [xs, Stream.periodic f n]
157+-- >>> interject n f xs = Stream.parListEagerFst [xs, Stream.periodic f n]
158--
158--
159-- Example:
159-- Example:
160--
160--
@@ -165,7 +165,7 @@ ticksRate r = parEval (rate (Just r)) $ Stream.repeatM (return ())
165--
165--
166{-# INLINE interject #-}
166{-# INLINE interject #-}
167interject :: MonadAsync m => m a -> Double -> Stream m a -> Stream m a
167interject :: MonadAsync m => m a -> Double -> Stream m a -> Stream m a
168−interject f n xs = parEagerFst [xs, periodic f n]
168+interject f n xs = parListEagerFst [xs, periodic f n]
169
169
170-- XXX No element should be yielded if the duration is zero.
170-- XXX No element should be yielded if the duration is zero.
171
171