netwire-4.0.6: Flexible wire arrows for FRP

MaintainerErtugrul Soeylemez <es@ertes.de>
Safe HaskellNone

Control.Wire.Prefab.Accum

Contents

Description

Accumulation wires. These are left-scan equivalents of several sorts.

Synopsis

General

Accumulation

accum :: (b -> a -> b) -> b -> Wire e m a bSource

The most general accumulator. This wire corresponds to a left scan.

  • Depends: previous instant.

accumT :: (Time -> b -> a -> b) -> b -> Wire e m a bSource

Like accum, but the accumulation function also receives the current time delta.

  • Depends: previous instant.

accum1 :: (b -> a -> b) -> b -> Wire e m a bSource

Non-delaying variant of accum.

  • Depends: current instant.

accumT1 :: (Time -> b -> a -> b) -> b -> Wire e m a bSource

Non-delaying variant of accumT.

  • Depends: current instant.

Function iteration

iterateW :: (b -> b) -> b -> Wire e m a bSource

Apply the input function continously. Corresponds to iterate for lists.

iterateWT :: (Time -> b -> b) -> b -> Wire e m a bSource

Like iterate, but the accumulation function also receives the current time delta.

Generic unfolding

unfold :: (s -> a -> (b, s)) -> s -> Wire e m a bSource

Corresponds to unfoldr for lists.

  • Depends: current instant, if the unfolding function is strict in its second argument.

unfoldT :: (Time -> s -> a -> (b, s)) -> s -> Wire e m a bSource

Like unfold, but the accumulation function also receives the current time delta.

  • Depends: current instant, if the given function is strict in its third argument.

Special

countFrom :: AdditiveGroup b => b -> Wire e m b bSource

Counts from the given vector adding the current input for the next instant.

  • Depends: previous instant.

enumFromW :: Enum b => b -> Wire e m a bSource

Enumerates from the given element.

mconcatW :: Monoid b => Wire e m b bSource

Running Monoid sum.

  • Depends: previous instant.