netwire-4.0.3: Flexible wire arrows for FRP

MaintainerErtugrul Soeylemez <es@ertes.de>
Safe HaskellNone

Control.Wire.Trans.Combine

Contents

Description

Wire combinators to manage sets of wires.

Synopsis

Multiplexing

contextSource

Arguments

:: forall a b m e k . (Monad m, Ord k) 
=> (a -> k)

Function to turn the signal into a context.

-> Wire e m a b

Base wire.

-> Wire e m a b 

The argument function turns the input signal into a context. For each context the given base wire evolves individually.

Note: Incorrect usage can lead to a memory leak. Consider using contextLimit instead.

  • Complexity: O(n) space, O(log n) time wrt to number of stored contexts.
  • Depends: current instant.
  • Inhibits: when the context wire inhibits.

contextLatestSource

Arguments

:: (Monad m, Ord k) 
=> (a -> k)

Signal to context.

-> Int

Maximum number of latest wires.

-> Wire e m a b

Base wire.

-> Wire e m a b 

Same as context, but keeps only the latest given number of contexts.

contextLimitSource

Arguments

:: forall a b m e k . (Monad m, Ord k) 
=> (a -> k)

Function to turn the signal into a context.

-> (forall w. Int -> Time -> TimedMap Time k w -> TimedMap Time k w)

Cleanup function. Receives the current instant number, the current local time and the current map.

-> Wire e m a b

Base wire.

-> Wire e m a b 

Same as context, but applies the given cleanup function to the context map at every instant. This can be used to drop older wires.

Multicast

multicast :: (Monad m, Traversable f) => f (Wire e m a b) -> Wire e m a (f b)Source

Broadcast the input signal to all of the given wires collecting their results. Each of the given subwires is evolved individually.

  • Depends: like the most dependent subwire.
  • Inhibits: when any of the subwires inhibits.