lawless-concurrent-machines-0.3.1: Concurrent networked stream transducers

Safe HaskellNone
LanguageHaskell2010

Data.Machine.Concurrent.Fanout

Description

Provide a notion of fanout wherein a single input is passed to several consumers. The consumers are run concurrently.

Synopsis

Documentation

fanout :: (MonadBaseControl IO m, Semigroup r) => [ProcessT m a r] -> ProcessT m a r Source #

Share inputs with each of a list of processes in lockstep. Any values yielded by the processes for a given input are combined into a single yield from the composite process.

fanoutSteps :: (MonadBaseControl IO m, Monoid r) => [ProcessT m a r] -> ProcessT m a r Source #

Share inputs with each of a list of processes in lockstep. If none of the processes yields a value, the composite process will itself yield mempty. The idea is to provide a handle on steps only executed for their side effects. For instance, if you want to run a collection of ProcessTs that await but don't yield some number of times, you can use 'fanOutSteps . map (fmap (const ()))' followed by a taking process.