Maintainer | Ertugrul Soeylemez <es@ertes.de> |
---|---|

Safe Haskell | None |

Event-related wire combinators.

- eitherE :: (Monad m, Monoid e) => (b1 -> b) -> (b2 -> b) -> (b1 -> b2 -> b) -> Wire e m a b1 -> Wire e m a b2 -> Wire e m a b
- (<||>) :: (Monad m, Monoid e, Semigroup b) => Wire e m a b -> Wire e m a b -> Wire e m a b
- hold :: Monad m => b -> Wire e m a b -> Wire e m a b
- hold_ :: Monad m => Wire e m a b -> Wire e m a b
- holdFor :: Monad m => Time -> Wire e m a b -> Wire e m a b
- holdForI :: Monad m => Int -> Wire e m a b -> Wire e m a b
- (<!>) :: Monad m => Wire e m a b -> e -> Wire e m a b
- event :: Monad m => Wire e m a b -> Wire e m a (Maybe b)
- exhibit :: Monad m => Wire e m a b -> Wire e m a (Either e b)
- gotEvent :: Monad m => Wire e m a b -> Wire e m a Bool
- notE :: (Monad m, Monoid e) => Event e m a -> Event e m a

# Combinators

:: (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 => Int -> 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.