on master help sign in
Add some TODO comments
commit39fcfd909c3066130c039ba7d3d4f16e48108a47 authorHarendra Kumar <harendra.kumar@gmail.com> dateFri 2 Aug 2019, 02:59 (7 years ago) parent2c36c13
2 files changed+23
src/Streamly/Streams/Parallel.hs+7 src/Streamly/Streams/Serial.hs+16
src/Streamly/Streams/Parallel.hs+7
@@ -147,6 +147,13 @@ joinStreamVarPar style ss m1 m2 = mkStream $ \st yld sng stp ->
147147consMParallel :: MonadAsync m => m a -> ParallelT m a -> ParallelT m a
148148consMParallel m r = fromStream $ K.yieldM m `parallel` (toStream r)
149149
150+-- TODO
151+-- Different variants of parallel differ in how the combined stream ends:
152+--
153+-- - - parallel - ends when all stream end
154+-- parallelEndByFirst - parallel1 - ends when the first stream ends
155+-- parallelEndByAny - parallel_ - ends when any stream ends
156+--
150157-- | Polymorphic version of the 'Semigroup' operation '<>' of 'ParallelT'
151158-- Merges two streams concurrently.
152159--
src/Streamly/Streams/Serial.hs+16
@@ -299,6 +299,22 @@ instance IsStream WSerialT where
299299-- Semigroup
300300------------------------------------------------------------------------------
301301
302+-- TODO
303+-- We always starts with the first stream yielding but there can be many ways
304+-- to end it. In general we can have the following variants of interleaving
305+-- streams:
306+-- wSerial - interleave - end when both streams end
307+-- wSerialEndByAny - interleave_ - end as soon as any stream ends
308+-- wSerialEndByFirst - interleave1 - make sure we end with first
309+-- - - interleave2 - make sure we end with second
310+--
311+-- Additionally we can have m elements yield from the first stream and n
312+-- elements yeilding from the second stream. We can also have time slicing
313+-- variants of positional interleaving, e.g. run first stream for m seconds and
314+-- run the second stream for n seconds.
315+--
316+-- Similar combinators can be implemented using WAhead style.
317+
302318-- | Polymorphic version of the 'Semigroup' operation '<>' of 'WSerialT'.
303319-- Interleaves two streams, yielding one element from each stream alternately.
304320-- When one stream stops the rest of the other stream is used in the output