netwire-4.0.4: Flexible wire arrows for FRP

Maintainer Ertugrul Soeylemez None

Control.Wire.Trans.Event

Contents

Description

Event-related wire combinators.

Synopsis

# Combinators

Arguments

 :: (Monad m, Monoid e) => (b1 -> b) Only left. -> (b2 -> b) Only right. -> (b1 -> b2 -> b) Both. -> Wire e m a b1 First wire. -> Wire e m a b2 Second wire. -> Wire e m a b

Try both wires combining their results with the given functions.

• Like argument wires.
• Inhibits: when both wires inhibit.

(<||>) :: (Monad m, Monoid e, Semigroup b) => Wire e m a b -> Wire e m a b -> Wire e m a bSource

Semigroup version of `eitherE`.

# Holding events

hold :: Monad m => b -> Wire e m a b -> Wire e m a bSource

Hold the latest event. Produces the last produced value starting with the given one.

• Depends: like argument wire.

hold_ :: Monad m => Wire e m a b -> Wire e m a bSource

Hold the event. Once the argument wire produces the produced value is held until the argument wire produces again.

• Depends: like argument wire.
• Inhibits: until the argument wire produces for the first time.

holdFor :: Monad m => Time -> Wire e m a b -> Wire e m a bSource

Hold the event for the given amount of time. When the argument wire produces, the produced value is kept for the given amount of time. If the wire produces again while another value is kept, the new value takes precedence.

• Depends: like argument wire.
• Inhibits: as described.

holdForI :: Monad m => Time -> Wire e m a b -> Wire e m a bSource

Hold the event for the given number of instances. When the argument wire produces, the produced value is kept for the given number of instances. If the wire produces again while another value is kept, the new value takes precedence.

• Depends: like argument wire.
• Inhibits: as described.

# Inhibition

(<!>) :: Monad m => Wire e m a b -> e -> Wire e m a bSource

If the argument wire inhibits, inhibit with the given exception instead.

• Depends: like argument wire.
• Inhibits: like argument wire.

event :: Monad m => Wire e m a b -> Wire e m a (Maybe b)Source

Prevent a wire from inhibiting. Instead produce a signal wrapped in `Maybe`.

Note: You probably shouldn't use this function.

• Depends: like argument wire.

exhibit :: Monad m => Wire e m a b -> Wire e m a (Either e b)Source

Prevent a wire from inhibiting. Instead produce the inhibition value.

Note: You probably shouldn't use this function.

• Depends: like argument wire.

gotEvent :: Monad m => Wire e m a b -> Wire e m a BoolSource

Prevent a wire from inhibiting. Instead produce `False`, if the wire inhibited.

Note: You probably shouldn't use this function.

• Depends: like argument wire.

notE :: (Monad m, Monoid e) => Event e m a -> Event e m aSource

Act like the identity wire, if the argument wire inhibits. Inhibit, if the argument wire produces.

• Depends: like argument wire.
• Inhibits: when argument wire produces.