on master help sign in
Add run functions for individual stream types
1b88113Harendra Kumar
src/Asyncly.hs+9−3
@@ -72,9 +72,6 @@ module Asyncly
72 -- * Custom Composition
72 -- * Custom Composition
73 , async
73 , async
74
74
75− -- * Running Streams
76− , runStreaming
77−
78 -- * Stream Type Adapters
75 -- * Stream Type Adapters
79 , serially
76 , serially
80 , interleaving
77 , interleaving
@@ -84,6 +81,15 @@ module Asyncly
84 , zippingAsync
81 , zippingAsync
85 , adapt
82 , adapt
86
83
84+ -- * Running Streams
85+ , runStreaming
86+ , runStreamT
87+ , runInterleavedT
88+ , runAsyncT
89+ , runParallelT
90+ , runZipStream
91+ , runZipAsync
92+
87 -- * Fold Utilities
93 -- * Fold Utilities
88 , foldWith
94 , foldWith
89 , foldMapWith
95 , foldMapWith
src/Asyncly/Streams.hs+36
@@ -35,6 +35,14 @@ module Asyncly.Streams
35 , zipping
35 , zipping
36 , zippingAsync
36 , zippingAsync
37 , adapt
37 , adapt
38+
39+ -- * Running Streams
40+ , runStreamT
41+ , runInterleavedT
42+ , runAsyncT
43+ , runParallelT
44+ , runZipStream
45+ , runZipAsync
38 )
46 )
39where
47where
40
48
@@ -659,3 +667,31 @@ zipping x = x
659-- | Interpret an ambiguously typed stream as 'ZipAsync'.
667-- | Interpret an ambiguously typed stream as 'ZipAsync'.
660zippingAsync :: ZipAsync m a -> ZipAsync m a
668zippingAsync :: ZipAsync m a -> ZipAsync m a
661zippingAsync x = x
669zippingAsync x = x
670+
671+-------------------------------------------------------------------------------
672+-- Running Streams, convenience functions specialized to types
673+-------------------------------------------------------------------------------
674+
675+-- | Run a 'StreamT' computation. Same as @runStreaming . serially@.
676+runStreamT :: Monad m => StreamT m a -> m ()
677+runStreamT = runStreaming
678+
679+-- | Run an 'InterleavedT' computation. Same as @runStreaming . interleaving@.
680+runInterleavedT :: Monad m => InterleavedT m a -> m ()
681+runInterleavedT = runStreaming
682+
683+-- | Run an 'AsyncT' computation. Same as @runStreaming . asyncly@.
684+runAsyncT :: Monad m => AsyncT m a -> m ()
685+runAsyncT = runStreaming
686+
687+-- | Run a 'ParallelT' computation. Same as @runStreaming . parallely@.
688+runParallelT :: Monad m => ParallelT m a -> m ()
689+runParallelT = runStreaming
690+
691+-- | Run a 'ZipStream' computation. Same as @runStreaming . zipping@.
692+runZipStream :: Monad m => ZipStream m a -> m ()
693+runZipStream = runStreaming
694+
695+-- | Run a 'ZipAsync' computation. Same as @runStreaming . zippingAsync@.
696+runZipAsync :: Monad m => ZipAsync m a -> m ()
697+runZipAsync = runStreaming