machines-0.2.5: Networked stream transducers

Safe HaskellSafe-Inferred

Data.Machine.Fanout

Description

Provide a notion of fanout wherein a single input is passed to several consumers.

Synopsis

Documentation

fanout :: (Functor m, Monad m, Semigroup r) => [ProcessT m a r] -> ProcessT m a rSource

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

fanoutSteps :: (Functor m, Monad m, Monoid r) => [ProcessT m a r] -> ProcessT m a rSource

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.