netwire-2.0.1: Generic automaton arrow transformer and useful tools

MaintainerErtugrul Soeylemez <es@ertes.de>

Control.Wire.Trans.Sample

Contents

Description

Wire transformers for sampling wires.

Synopsis

Sampling

hold :: Arrow >~ => Wire e >~ a b -> Wire e >~ a bSource

Keeps the latest produced value.

  • Depends: Like argument wire. * Inhibits: Until first production.

holdWith :: Arrow >~ => b -> Wire e >~ a b -> Wire e >~ a bSource

Keeps the latest produced value. Produces the argument value until the argument wire starts producing.

  • Depends: Like argument wire.

sample :: forall a b e t (>~). (ArrowChoice >~, ArrowClock >~, Num t, Ord t, Time >~ ~ t) => Wire e >~ a b -> Wire e >~ (a, t) bSource

Samples the given wire at discrete intervals. Only runs the input through the wire, then the next sampling interval has elapsed.

  • Depends: Current instant (left), like argument wire at sampling intervals (right). * Inhibits: Starts inhibiting when argument wire inhibits. Keeps inhibiting until next sampling interval.

swallow :: ArrowChoice >~ => Wire e >~ a b -> Wire e >~ a bSource

Waits for the argument wire to produce and then keeps the first produced value forever.

  • Depends: Like argument wire until first production. Then stops depending. * Inhibits: Until the argument wire starts producing.