netwire-2.0.1: Generic automaton arrow transformer and useful tools

MaintainerErtugrul Soeylemez <es@ertes.de>

Control.Wire.Prefab.Event

Contents

Description

Wires for generating and manipulating events.

Synopsis

Event generation

Timed

after :: forall e t (>~). (ArrowClock >~, Monoid e, Num t, Ord t, Time >~ ~ t) => Wire e >~ t ()Source

Produces once after the input time delta has passed.

  • Depends: Current instant.
  • Inhibits: Always except at the target instant.

at :: (ArrowClock >~, Monoid e, Ord t, Time >~ ~ t) => Wire e >~ t ()Source

Produces once as soon as the current time is later than or equal to the current time and never again.

  • Depends: Current instant.
  • Inhibits: Always except at the target instant.

delayEvents :: forall b e t (>~). (ArrowClock >~, Monoid e, Num t, Ord t, Time >~ ~ t) => Wire e >~ ([b], t) bSource

Delays each incoming event (left signal) by the given time delta (right signal). The time delta at the instant the event happened is significant.

  • Depends: Current instant.
  • Inhibits: When no delayed event happened.

delayEventsSafe :: forall b e t (>~). (ArrowClock >~, Monoid e, Num t, Ord t, Time >~ ~ t) => Wire e >~ (([b], t), Int) bSource

Delays each incoming event (left signal) by the given time delta (middle signal). The time delta at the instant the event happened is significant. The right signal gives a maximum number of events queued. When exceeded, new events are dropped, until there is enough room.

  • Depends: Current instant.
  • Inhibits: When no delayed event happened.

periodically :: forall e t (>~). (ArrowClock >~, Monoid e, Num t, Ord t, Time >~ ~ t) => Wire e >~ t ()Source

Periodically produces an event. The period is given by the input time delta and can change over time. The current time delta with respect to the last production is significant. Does not produce at the first instant, unless the first delta is nonpositive.

  • Depends: Current instant.
  • Inhibits: Always except at the periodic ticks.

Unconditional inhibition

inhibit :: Wire e >~ e bSource

Never produces. Always inhibits with the current input signal.

  • Depends: Current instant.
  • Inhibits: Always.

never :: Monoid e => Wire e >~ a bSource

Never produces. Equivalent to zeroArrow.

  • Inhibits: Always.

Predicate-based

asSoonAs :: Monoid e => Wire e >~ Bool ()Source

Inhibits as long as the input signal is False. Once it switches to True, it produces forever.

  • Depends: Current instant.
  • Inhibits: As long as input signal is False, then never again.

edge :: forall e (>~). Monoid e => Wire e >~ Bool ()Source

Produces once whenever the input signal switches from False to True.

  • Depends: Current instant.
  • Inhibits: Always except at the above mentioned instants.

require :: Monoid e => Wire e >~ Bool ()Source

Produces, whenever the current input signal is True.

  • Depends: Current instant.
  • Inhibits: When input is False.

forbid :: Monoid e => Wire e >~ Bool ()Source

Produces, whenever the current input signal is False.

  • Depends: Current instant.
  • Inhibits: When input is True.

while :: Monoid e => Wire e >~ Bool ()Source

Produce as long as the input signal is True. Once it switches to False, never produce again. Corresponds to takeWhile for lists.

  • Depends: Current instant.
  • Inhibits: As soon as input becomes False.

Instant-based

notYet :: Monoid e => Wire e >~ b bSource

Inhibit at the first instant. Then produce forever.

  • Inhibits: At the first instant.

once :: Monoid e => Wire e >~ b bSource

Acts like the identity function once and never again.

  • Inhibits: After the first instant.