Maintainer | Ertugrul Soeylemez <es@ertes.de> |
---|

The usual FRP tools you'll want to work with.

- constant :: Monad m => 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
- accum :: Monad m => a -> Wire m (a -> a) a
- delay :: Monad m => a -> Wire m a a
- discrete :: forall a m. Monad m => Wire m (Time, a) a
- hold :: forall a b m. Monad m => Wire m a b -> Wire m a b
- inject :: forall a e m. (Exception e, Monad m) => Wire m (Either e a) a
- injectMaybe :: Monad m => Wire m (Maybe a) a
- keep :: Monad m => Wire m a a
- forbid :: Monad m => Wire m (Bool, a) a
- forbid_ :: Monad m => Wire m Bool ()
- inhibit :: (Exception e, Monad m) => Wire m e b
- inhibit_ :: Monad m => Wire m a b
- require :: Monad m => Wire m (Bool, a) a
- require_ :: Monad m => Wire m Bool ()
- 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
- 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 :: Monad m => b -> Wire m a bSource

The constant wire. Please use this function instead of ```
arr (const
c)
```

.

Never inhibits.

identity :: Monad m => Wire m a aSource

Identity signal transformer. Outputs its input.

Never inhibits. Feedback by delay.

# Time

timeFrom :: Monad m => Time -> Wire m a TimeSource

Get the local time, assuming it starts from the given value.

Never inhibits.

# Signal transformers

accum :: Monad m => a -> Wire m (a -> a) aSource

This function corresponds to the `iterate`

function for lists.
Begins with an initial output value. Each time an input function is
received, it is applied to the current accumulator and the new value
is emitted.

Never inhibits. Direct feedback.

delay :: Monad m => a -> Wire m a aSource

One-instant delay. Delay the signal for an instant returning the
argument value at the first instant. This wire is mainly useful to
add feedback support to wires, which wouldn't support it by
themselves. For example, the `FRP.NetWire.Analyze.avg`

wire does not
support feedback by itself, but the following works:

do rec x <- delay 1 <<< avg 1000 -< x

Never inhibits. Direct feedback.

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`

.

Never inhibits. Feedback by delay.

hold :: forall a b m. Monad m => Wire m a b -> Wire m a bSource

Keep the latest output.

Inhibits until first signal from argument wire. Same feedback properties as argument wire.

injectMaybe :: Monad m => Wire m (Maybe a) aSource

keep :: Monad m => Wire m a aSource

Keep the value in the first instant forever.

Never inhibits. Feedback by delay.

# Inhibitors

forbid :: Monad m => Wire m (Bool, a) aSource

Inhibit, when the left signal is true.

Inhibits on true left signal. No feedback.

forbid_ :: Monad m => Wire m Bool ()Source

Inhibit, when the signal is true.

Inhibits on true signal. No feedback.

inhibit :: (Exception e, Monad m) => Wire m e bSource

Unconditional inhibition with the given inhibition exception.

Always inhibits.

inhibit_ :: Monad m => Wire m a bSource

Unconditional inhibition with default inhibition exception.

Always inhibits.

require :: Monad m => Wire m (Bool, a) aSource

Inhibit, when the left signal is false.

Inhibits on false left signal. No feedback.

require_ :: Monad m => Wire m Bool ()Source

Inhibit, when the signal is false.

Inhibits on false signal. No feedback.

# 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. See also `FRP.NetWire.Event.event`

.

Never inhibits. Same feedback properties as argument wire.

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.

Same inhibition properties as first instant of argument wire. Same feedback properties as first instant of argument wire.

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. Returns the most recent result.

The left signal interval is allowed to become zero, at which point the signal is passed through the wire at every instant.

Inhibits until the first result from the argument wire. Same feedback properties as argument wire.

swallow :: Monad m => Wire m a b -> Wire m a bSource

Wait for the first signal from the given wire and keep it forever.

Inhibits until signal from argument wire. Direct feedback, if argument wire never inhibits, otherwise no feedback.

(-->) :: Monad m => b -> Wire m a b -> Wire m a bSource

Override the output value at the first non-inhibited instant.

Same inhibition properties as argument wire. Same feedback properties as argument wire.

(>--) :: Monad m => a -> Wire m a b -> Wire m a bSource

Override the input value, until the wire starts producing.

Same inhibition properties as argument wire. Same feedback properties as argument wire.

(-=>) :: 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.

Same inhibition properties as argument wire. Same feedback properties as argument wire.

(>=-) :: 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.

Same inhibition properties as argument wire. Same feedback properties as argument wire.

# Arrow tools

mapA :: ArrowChoice a => a b c -> a [b] [c]Source

Apply an arrow to a list of inputs.