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

Safe Haskell | None |

Event wires.

- afterI :: Monoid e => Int -> Event e m a
- eventsI :: Monoid e => [Int] -> Event e m a
- forI :: Monoid e => Int -> Event e m a
- notYet :: Monoid e => Event e m a
- once :: Monoid e => Event e m a
- periodicallyI :: Monoid e => Int -> Event e m a
- changed :: (Eq a, Monoid e) => Event e m a
- inject :: Injectable e f => Wire e m (f b) b
- asSoonAs :: Monoid e => (a -> Bool) -> Event e m a
- edge :: Monoid e => (a -> Bool) -> Event e m a
- forbid :: Monoid e => (a -> Bool) -> Event e m a
- require :: Monoid e => (a -> Bool) -> Event e m a
- unless :: Monoid e => (a -> Bool) -> Event e m a
- until :: Monoid e => (a -> Bool) -> Event e m a
- when :: Monoid e => (a -> Bool) -> Event e m a
- while :: Monoid e => (a -> Bool) -> Event e m a
- after :: Monoid e => Time -> Event e m a
- events :: Monoid e => [Time] -> Event e m a
- for :: Monoid e => Time -> Event e m a
- periodically :: Monoid e => Time -> Event e m a
- inhibit :: e -> Wire e m a b

# Instants

afterI :: Monoid e => Int -> Event e m aSource

Produce after the given number of instants.

- Depends: current instant when producing.
- Inhibits: until the given number of instants has passed.

eventsI :: Monoid e => [Int] -> Event e m aSource

Variant of `periodically`

in number of instants instead of amount
of time.

- Depends: current instant when producing.
- Inhibits: between the given intervals.

forI :: Monoid e => Int -> Event e m aSource

Produce for the given number of instants.

- Depends: current instant when producing.
- Inhibits: after the given number of instants has passed.

notYet :: Monoid e => Event e m aSource

Inhibit once.

- Depends: current instant after the first instant.
- Inhibits: in the first instant.

once :: Monoid e => Event e m aSource

Produce once.

- Depends: current instant in the first instant.
- Inhibits: after the first instant.

periodicallyI :: Monoid e => Int -> Event e m aSource

Produce once periodically with the given number of instants as the interval.

- Depends: current instant when producing.
- Inhibits: between the intervals.

# Signal analysis

changed :: (Eq a, Monoid e) => Event e m aSource

Produce when the signal has changed and at the first instant.

- Depends: current instant.
- Inhibits: after the first instant when the input has changed.

inject :: Injectable e f => Wire e m (f b) bSource

Inject the input signal. Please keep in mind that in application code it is almost always wrong to use this wire. It should only be used to interact with other frameworks/abstractions, and even then it's probably just a last resort.

When you want to write your own wires, consider using `mkPure`

or the
various variants of it.

- Depends: current instant.
- Inhibits: depending on input signal (see
`Injectable`

).

## Predicate-based

asSoonAs :: Monoid e => (a -> Bool) -> Event e m aSource

Inhibit until the given predicate holds for the input signal. Then produce forever.

- Depends: current instant, if the predicate is strict. Once true, on current instant forever.
- Inhibits: until the predicate becomes true.

unless :: Monoid e => (a -> Bool) -> Event e m aSource

Produce when the given predicate on the input signal does not hold.

- Depends: current instant if the predicate is strict.
- Inhibits: When the predicate is true.

until :: Monoid e => (a -> Bool) -> Event e m aSource

Produce until the given predicate on the input signal holds, then inhibit forever.

- Depends: current instant, if the predicate is strict.
- Inhibits: forever as soon as the predicate becomes true.

when :: Monoid e => (a -> Bool) -> Event e m aSource

Produce when the given predicate on the input signal holds.

- Depends: current instant if the predicate is strict.
- Inhibits: When the predicate is false.

while :: Monoid e => (a -> Bool) -> Event e m aSource

Produce while the given predicate on the input signal holds, then inhibit forever.

- Depends: current instant, if the predicate is strict.
- Inhibits: forever as soon as the predicate becomes false.

# Time

after :: Monoid e => Time -> Event e m aSource

Produce after the given amount of time.

- Depends: current instant when producing, time.
- Inhibits: until the given amount of time has passed.

events :: Monoid e => [Time] -> Event e m aSource

Produce once periodically. The production periods are given by the
argument list. When it's `[1,2,3]`

it produces after one second,
then after two more seconds and finally after three more seconds.
When the list is exhausted, it never produces again.

- Depends: current instant when producing, time.
- Inhibits: between the given intervals.

for :: Monoid e => Time -> Event e m aSource

Produce for the given amount of time.

- Depends: current instant when producing, time.
- Inhibits: after the given amount of time has passed.

periodically :: Monoid e => Time -> Event e m aSource

Produce once periodically with the given time interval.

- Depends: current instant when producing, time.
- Inhibits: between the intervals.