Safe Haskell | None |
---|
- psequence_ :: (ListLike s el, Nullable s) => [Iteratee s IO a] -> Iteratee s IO ()
- parE :: (Nullable s1, Nullable s2, Monoid s1) => Enumeratee s1 s2 IO r -> Enumeratee s1 s2 IO r
- parI :: (Nullable s, Monoid s) => Iteratee s IO a -> Iteratee s IO a
- liftParI :: (Nullable s, Monoid s, MonadIO m) => Iteratee s IO a -> Iteratee s m a
- mapReduce :: (Monad m, Nullable s, Monoid b) => Int -> (s -> b) -> Iteratee s m b
Documentation
psequence_ :: (ListLike s el, Nullable s) => [Iteratee s IO a] -> Iteratee s IO ()Source
Enumerate a list of iteratees over a single stream simultaneously and discard the results. Each iteratee runs in a separate forkIO thread, passes all errors from iteratees up.
parE :: (Nullable s1, Nullable s2, Monoid s1) => Enumeratee s1 s2 IO r -> Enumeratee s1 s2 IO rSource
Transform an Enumeratee into a parallel composable one, introducing
one step extra delay, see parI
.
parI :: (Nullable s, Monoid s) => Iteratee s IO a -> Iteratee s IO aSource
Transform usual Iteratee into parallel composable one, introducing one step extra delay.
Ex - time spent in Enumerator working on x'th packet Ix - time spent in Iteratee working on x'th packet z - last packet, y = (z-1)'th packet
regular Iteratee: E0 - I0, E1 - I1, E2 - I2 .. Ez -> Iz parallel Iteratee: E0, E1, E2, .. Ez _ I0_ I1_ .. Iy__ Iz
liftParI :: (Nullable s, Monoid s, MonadIO m) => Iteratee s IO a -> Iteratee s m aSource
A variant of parI
with the parallelized iteratee lifted into an
arbitrary MonadIO.
:: (Monad m, Nullable s, Monoid b) | |
=> Int | maximum number of chunks to read |
-> (s -> b) | map function |
-> Iteratee s m b |
Perform a parallel map/reduce. The bufsize
parameter controls
the maximum number of chunks to read at one time. A larger bufsize
allows for greater parallelism, but will require more memory.
Implementation of sum
sum :: (Monad m, LL.ListLike s, Nullable s) => Iteratee s m Int64 sum = getSum <$> mapReduce 4 (Sum . LL.sum)