netwire-4.0.1: Flexible wire arrows for FRP

Copyright(c) 2012 Ertugrul Soeylemez
LicenseBSD3
MaintainerErtugrul Soeylemez <es@ertes.de>
Safe HaskellNone
LanguageHaskell2010

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 b Source

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

  • Depends: previous instant.

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

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

  • Depends: previous instant, time.

Function iteration

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

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

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

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

  • Depends: time.

Generic unfolding

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

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 b Source

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

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

Special

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

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

  • Depends: previous instant.

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

Enumerates from the given element.

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

Running Monoid sum.

  • Depends: previous instant.