machines-0.6.4: Networked stream transducers

Safe HaskellNone
LanguageHaskell2010

Data.Machine.Group

Synopsis

Documentation

groupingOn :: Monad m => (a -> a -> Bool) -> ProcessT m a b -> ProcessT m a b Source #

Using a function to signal group changes, apply a machine independently over each group.

taggedBy :: Monad m => (a -> a -> Bool) -> ProcessT m a (Either () a) Source #

Mark a transition point between two groups as a function of adjacent elements. Examples

>>> runT $ supply [1,2,2] (taggedBy (==))
[Right 1,Left (),Right 2,Right 2]

partitioning :: Monad m => ProcessT m a b -> ProcessT m (Either () a) b Source #

Run a machine multiple times over partitions of the input stream specified by Left () values.

starve :: Monad m => MachineT m k0 b -> MachineT m k b -> MachineT m k b Source #

Run a machine with no input until it stops, then behave as another machine.

awaitUntil :: Monad m => (a -> Bool) -> (a -> ProcessT m a b) -> ProcessT m a b Source #

Read inputs until a condition is met, then behave as cont with | input matching condition as first input of cont. | If await fails, stop.