machines-0.1.2: Networked stream transducers

PortabilityRank-2 Types, GADTs
Stabilityprovisional
MaintainerEdward Kmett <ekmett@gmail.com>
Safe HaskellNone

Data.Machine.Wye

Contents

Description

 

Synopsis

Wyes

type Wye a b c = Machine Y (a, b) cSource

A Machine that can read from two input stream in a non-deterministic manner.

type WyeT m a b c = MachineT m Y (a, b) cSource

A Machine that can read from two input stream in a non-deterministic manner with monadic side-effects.

data Y i c whereSource

The input descriptor for a Wye or WyeT

Constructors

X :: Y (a, b) a 
Y :: Y (a, b) b 
Z :: Y (a, b) (Either a b) 

wye :: Monad m => ProcessT m a a' -> ProcessT m b b' -> WyeT m a' b' c -> WyeT m a b cSource

Compose a pair of pipes onto the front of a Wye.

Precompose a Process onto each input of a Wye (or WyeT).

This is left biased in that it tries to draw values from the X input whenever they are available, and only draws from the Y input when X would block.

addX :: Monad m => ProcessT m a b -> WyeT m b c d -> WyeT m a c dSource

Precompose a pipe onto the left input of a wye.

addY :: Monad m => ProcessT m b c -> WyeT m a c d -> WyeT m a b dSource

Precompose a pipe onto the right input of a tee.

capX :: Monad m => SourceT m a -> WyeT m a b c -> ProcessT m b cSource

Tie off one input of a tee by connecting it to a known source.

capY :: Monad m => SourceT m b -> WyeT m a b c -> ProcessT m a cSource

Tie off one input of a tee by connecting it to a known source.