netwire-4.0.5: Flexible wire arrows for FRP

MaintainerErtugrul Soeylemez <es@ertes.de>
Safe HaskellNone

Control.Wire.Prefab.Event

Contents

Description

Event wires.

Synopsis

Instants

afterI :: Monoid e => Int -> Event e m aSource

Produce after the given number of instants.

  • Depends: current instant when producing.
  • Inhibits: until the given number of instants has passed.

eventsI :: Monoid e => [Int] -> Event e m aSource

Variant of periodically in number of instants instead of amount of time.

  • Depends: current instant when producing.
  • Inhibits: between the given intervals.

forI :: Monoid e => Int -> Event e m aSource

Produce for the given number of instants.

  • Depends: current instant when producing.
  • Inhibits: after the given number of instants has passed.

notYet :: Monoid e => Event e m aSource

Inhibit once.

  • Depends: current instant after the first instant.
  • Inhibits: in the first instant.

once :: Monoid e => Event e m aSource

Produce once.

  • Depends: current instant in the first instant.
  • Inhibits: after the first instant.

periodicallyI :: Monoid e => Int -> Event e m aSource

Produce once periodically with the given number of instants as the interval.

  • Depends: current instant when producing.
  • Inhibits: between the intervals.

Signal analysis

changed :: (Eq a, Monoid e) => Event e m aSource

Produce when the signal has changed and at the first instant.

  • Depends: current instant.
  • Inhibits: after the first instant when the input has changed.

inject :: Injectable e f => Wire e m (f b) bSource

Inject the input signal. Please keep in mind that in application code it is almost always wrong to use this wire. It should only be used to interact with other frameworks/abstractions, and even then it's probably just a last resort.

When you want to write your own wires, consider using mkPure or the various variants of it.

  • Depends: current instant.
  • Inhibits: depending on input signal (see Injectable).

Predicate-based

asSoonAs :: Monoid e => (a -> Bool) -> Event e m aSource

Inhibit until the given predicate holds for the input signal. Then produce forever.

  • Depends: current instant, if the predicate is strict. Once true, on current instant forever.
  • Inhibits: until the predicate becomes true.

edge :: Monoid e => (a -> Bool) -> Event e m aSource

Produces once whenever the given predicate switches from False to True.

  • Depends: current instant.
  • Inhibits: when the predicate has not just switched from False to True.

forbid :: Monoid e => (a -> Bool) -> Event e m aSource

Same as unless.

require :: Monoid e => (a -> Bool) -> Event e m aSource

Same as when.

unless :: Monoid e => (a -> Bool) -> Event e m aSource

Produce when the given predicate on the input signal does not hold.

  • Depends: current instant if the predicate is strict.
  • Inhibits: When the predicate is true.

until :: Monoid e => (a -> Bool) -> Event e m aSource

Produce until the given predicate on the input signal holds, then inhibit forever.

  • Depends: current instant, if the predicate is strict.
  • Inhibits: forever as soon as the predicate becomes true.

when :: Monoid e => (a -> Bool) -> Event e m aSource

Produce when the given predicate on the input signal holds.

  • Depends: current instant if the predicate is strict.
  • Inhibits: When the predicate is false.

while :: Monoid e => (a -> Bool) -> Event e m aSource

Produce while the given predicate on the input signal holds, then inhibit forever.

  • Depends: current instant, if the predicate is strict.
  • Inhibits: forever as soon as the predicate becomes false.

Time

after :: Monoid e => Time -> Event e m aSource

Produce after the given amount of time.

  • Depends: current instant when producing, time.
  • Inhibits: until the given amount of time has passed.

events :: Monoid e => [Time] -> Event e m aSource

Produce once periodically. The production periods are given by the argument list. When it's [1,2,3] it produces after one second, then after two more seconds and finally after three more seconds. When the list is exhausted, it never produces again.

  • Depends: current instant when producing, time.
  • Inhibits: between the given intervals.

for :: Monoid e => Time -> Event e m aSource

Produce for the given amount of time.

  • Depends: current instant when producing, time.
  • Inhibits: after the given amount of time has passed.

periodically :: Monoid e => Time -> Event e m aSource

Produce once periodically with the given time interval.

  • Depends: current instant when producing, time.
  • Inhibits: between the intervals.

Utilities

inhibit :: e -> Wire e m a bSource

Inhibit with the given value.

  • Inhibits: always.