Maintainer | Ertugrul Soeylemez <es@ertes.de> |
---|
Switching combinators. Note that Wire
also provides a
state-preserving Control.Arrow.ArrowApply
instance, which may be
more convenient than these combinators in many cases.
- switch :: Monad m => Wire m a (b, Maybe c) -> (c -> Wire m a b) -> Wire m a b
- dSwitch :: Monad m => Wire m a (b, Maybe c) -> (c -> Wire m a b) -> Wire m a b
- rSwitch :: Monad m => Wire m a b -> Wire m (a, Maybe (Wire m a b)) b
- drSwitch :: Monad m => Wire m a b -> Wire m (a, Maybe (Wire m a b)) b
- parB :: (Applicative m, Monad m, Traversable f) => f (Wire m a b) -> Wire m a (f b)
- rpSwitchB :: (Applicative m, Monad m, Traversable f) => f (Wire m a b) -> Wire m (a, Maybe (f (Wire m a b) -> f (Wire m a b))) (f b)
- drpSwitchB :: (Applicative m, Monad m, Traversable f) => f (Wire m a b) -> Wire m (a, Maybe (f (Wire m a b) -> f (Wire m a b))) (f b)
- par :: (Applicative m, Monad m, Traversable f) => (forall w. a -> f w -> f (b, w)) -> f (Wire m b c) -> Wire m a (f c)
- rpSwitch :: (Applicative m, Monad m, Traversable f) => (forall w. a -> f w -> f (b, w)) -> f (Wire m b c) -> Wire m (a, Maybe (f (Wire m b c) -> f (Wire m b c))) (f c)
- drpSwitch :: (Applicative m, Monad m, Traversable f) => (forall w. a -> f w -> f (b, w)) -> f (Wire m b c) -> Wire m (a, Maybe (f (Wire m b c) -> f (Wire m b c))) (f c)
- appEvent :: forall a b m. Monad m => Wire m a b -> Wire m (Maybe (Wire m a b), a) b
- appFirst :: forall a b m. Monad m => Wire m (Wire m a b, a) b
- appFrozen :: Monad m => Wire m (Wire m a b, a) b
Basic switches
switch :: Monad m => Wire m a (b, Maybe c) -> (c -> Wire m a b) -> Wire m a bSource
This is the most basic switching combinator. It is an event-based one-time switch.
The first argument is the initial wire, which may produce a switching event at some point. When this event is produced, then the signal path switches to the wire produced by the second argument function.
dSwitch :: Monad m => Wire m a (b, Maybe c) -> (c -> Wire m a b) -> Wire m a bSource
Decoupled variant of switch
.
rSwitch :: Monad m => Wire m a b -> Wire m (a, Maybe (Wire m a b)) bSource
Combinator for recurrent switches. The wire produced by this switch takes switching events and switches to the wires contained in the events. The first argument is the initial wire.
drSwitch :: Monad m => Wire m a b -> Wire m (a, Maybe (Wire m a b)) bSource
Decoupled variant of rSwitch
.
Broadcasters
parB :: (Applicative m, Monad m, Traversable f) => f (Wire m a b) -> Wire m a (f b)Source
Broadcast signal to a collection of signal functions. If any of the wires inhibits, then the whole parallel network inhibits.
rpSwitchB :: (Applicative m, Monad m, Traversable f) => f (Wire m a b) -> Wire m (a, Maybe (f (Wire m a b) -> f (Wire m a b))) (f b)Source
drpSwitchB :: (Applicative m, Monad m, Traversable f) => f (Wire m a b) -> Wire m (a, Maybe (f (Wire m a b) -> f (Wire m a b))) (f b)Source
Decoupled variant of rpSwitchB
.
Routers
par :: (Applicative m, Monad m, Traversable f) => (forall w. a -> f w -> f (b, w)) -> f (Wire m b c) -> Wire m a (f c)Source
Route signal to a collection of signal functions using the supplied routing function. If any of the wires inhibits, the whole network inhibits.
rpSwitch :: (Applicative m, Monad m, Traversable f) => (forall w. a -> f w -> f (b, w)) -> f (Wire m b c) -> Wire m (a, Maybe (f (Wire m b c) -> f (Wire m b c))) (f c)Source
drpSwitch :: (Applicative m, Monad m, Traversable f) => (forall w. a -> f w -> f (b, w)) -> f (Wire m b c) -> Wire m (a, Maybe (f (Wire m b c) -> f (Wire m b c))) (f c)Source
Decoupled variant of rpSwitch
.
Embedding wires
appEvent :: forall a b m. Monad m => Wire m a b -> Wire m (Maybe (Wire m a b), a) bSource
Embeds the input wire (left signal) into the network with the given
input signal (right signal). Each time the input wire is a Just
,
the current state of the last wire is discarded and the new wire is
evolved instead. New wires can be generated by an event wire and
catched via FRP.NetWire.Event.event
. The initial wire is given by
the argument.
Inhibits whenever the embedded wire inhibits. Same feedback behaviour as the embedded wire.
appFirst :: forall a b m. Monad m => Wire m (Wire m a b, a) bSource
Embeds the first received input wire (left signal) into the network, feeding it the right signal. This wire respects its left signal only in the first instant, after which it wraps that wire's evolution.
Inhibits whenever the embedded wire inhibits. Same feedback behaviour as the embedded wire.
appFrozen :: Monad m => Wire m (Wire m a b, a) bSource
Embeds the first instant of the input wire (left signal) into the network, feeding it the right signal. This wire respects its left signal in all instances, such that the embedded wire cannot evolve.
Inhibits whenever the embedded wire inhibits. Same feedback behaviour as the embedded wire.