netwire-3.1.0: Fast generic automaton arrow transformer for AFRP

MaintainerErtugrul Soeylemez <es@ertes.de>

Control.Wire.Trans.Memoize

Contents

Description

Memoizing wire transformers.

Synopsis

Memoizing

class Arrow >~ => WCache t (>~) | >~ -> t whereSource

Remember the most recently produced values. You can limit both the maximum age and the number of remembered values. The second input value specifies the maximum age, the third specifies the maximum number.

Note: Inhibtion is never remembered.

Note: Decreasing the size limit has O(n * log n) complexity, where n is the difference to the old limit.

  • Depends: Current instant.
  • Inhibits: Whenever result is not cached and argument wire inhibits.

Methods

cache :: Ord a => Wire e >~ a b -> Wire e >~ ((a, t), Int) bSource

Instances

(AdditiveGroup t, MonadClock t m, Ord t) => WCache t (Kleisli m) 

class Arrow >~ => WPurify (>~) whereSource

Remember the last produced value. Whenever an input is repeated, the argument wire is ignored and the memoized result is returned instantly. Note: inhibition will not be remembered.

  • Depends: Current instant.
  • Inhibits: Like the argument wire for non-memoized inputs.

Methods

purify :: Eq a => Wire e >~ a b -> Wire e >~ a bSource

Instances

Monad m => WPurify (Kleisli m)