Maintainer | Ertugrul Soeylemez <es@ertes.de> |
---|---|
Safe Haskell | None |
Wire combinators to manage sets of wires.
- context :: forall a b m e k. (Monad m, Ord k) => (a -> k) -> Wire e m a b -> Wire e m a b
- contextLatest :: (Monad m, Ord k) => (a -> k) -> Int -> Wire e m a b -> Wire e m a b
- contextLimit :: forall a b m e k. (Monad m, Ord k) => (a -> k) -> (forall w. Int -> Time -> TimedMap Time k w -> TimedMap Time k w) -> Wire e m a b -> Wire e m a b
- multicast :: (Monad m, Traversable f) => f (Wire e m a b) -> Wire e m a (f b)
Multiplexing
:: 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.
:: (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.
:: 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.