Maintainer | Ertugrul Soeylemez <es@ertes.de> |
---|
The usual FRP tools you'll want to work with.
- constant :: b -> Wire m a b
- identity :: Monad m => Wire m a a
- time :: Monad m => Wire m a Time
- timeFrom :: Monad m => Time -> Wire m a Time
- discrete :: forall a m. Monad m => Wire m (Time, a) a
- keep :: Monad m => Wire m a a
- inhibit :: (Exception e, Monad m) => Wire m e b
- require :: Monad m => Wire m (Bool, a) a
- exhibit :: Monad m => Wire m a b -> Wire m a (Output b)
- freeze :: Monad m => Wire m a b -> Wire m a b
- sample :: forall a b m. Monad m => Wire m a b -> Wire m (Time, a) b
- swallow :: Monad m => Wire m a b -> Wire m a b
- (-->) :: Monad m => b -> Wire m a b -> Wire m a b
- (>--) :: Monad m => a -> Wire m a b -> Wire m a b
- (-=>) :: Monad m => (b -> b) -> Wire m a b -> Wire m a b
- (>=-) :: Monad m => (a -> a) -> Wire m a b -> Wire m a b
- constantAfter :: Monad m => b -> b -> Wire m a b
- initially :: Monad m => a -> Wire m a a
- mapA :: ArrowChoice a => a b c -> a [b] [c]
- dup :: a -> (a, a)
- fmod :: Double -> Double -> Double
- swap :: (a, b) -> (b, a)
Basic utilities
constant :: b -> Wire m a bSource
The constant wire. Please use this function instead of arr (const
c)
.
Time
timeFrom :: Monad m => Time -> Wire m a TimeSource
Get the local time, assuming it starts from the given value.
Signal transformers
discrete :: forall a m. Monad m => Wire m (Time, a) aSource
Turn a continuous signal into a discrete one. This transformer picks values from the right signal at intervals of the left signal.
The interval length is followed in real time. If it's zero, then
this wire acts like second id
.
Inhibitors
inhibit :: (Exception e, Monad m) => Wire m e bSource
Unconditional inhibition with the given inhibition exception.
Wire transformers
exhibit :: Monad m => Wire m a b -> Wire m a (Output b)Source
This function corresponds to try
for exceptions, allowing you to
observe inhibited signals.
freeze :: Monad m => Wire m a b -> Wire m a bSource
Effectively prevent a wire from rewiring itself. This function will turn any stateful wire into a stateless wire, rendering most wires useless.
Note: This function should not be used normally. Use it only, if you know exactly what you're doing.
sample :: forall a b m. Monad m => Wire m a b -> Wire m (Time, a) bSource
Sample the given wire at specific intervals. Use this instead of
discrete
, if you want to prevent the signal from passing through
the wire all the time.
The left signal interval is allowed to become zero, at which point the signal is passed through the wire at every instant.
swallow :: Monad m => Wire m a b -> Wire m a bSource
Wait for the first signal from the given wire and keep it forever.
(-->) :: Monad m => b -> Wire m a b -> Wire m a bSource
Override the output value at the first non-inhibited instant.
(>--) :: Monad m => a -> Wire m a b -> Wire m a bSource
Override the input value, until the wire starts producing.
(-=>) :: Monad m => (b -> b) -> Wire m a b -> Wire m a bSource
Apply a function to the wire's output at the first non-inhibited instant.
(>=-) :: Monad m => (a -> a) -> Wire m a b -> Wire m a bSource
Apply a function to the wire's input, until the wire starts producing.
Switches
Unconditional switches
constantAfter :: Monad m => b -> b -> Wire m a bSource
Produce the value of the second argument at the first instant. Then produce the second value forever.
initially :: Monad m => a -> Wire m a aSource
Produce the argument value at the first instant. Then act as the identity signal transformer forever.
Arrow tools
mapA :: ArrowChoice a => a b c -> a [b] [c]Source
Apply an arrow to a list of inputs.