Copyright | (c) 2013 Ertugrul Soeylemez |
---|---|

License | BSD3 |

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

Safe Haskell | None |

Language | Haskell2010 |

- data Event a
- at :: HasTime t s => t -> Wire s e m a (Event a)
- never :: Wire s e m a (Event b)
- now :: Wire s e m a (Event a)
- periodic :: HasTime t s => t -> Wire s e m a (Event a)
- periodicList :: HasTime t s => t -> [b] -> Wire s e m a (Event b)
- became :: (a -> Bool) -> Wire s e m a (Event a)
- noLonger :: (a -> Bool) -> Wire s e m a (Event a)
- edge :: (a -> Bool) -> Wire s e m a (Event a)
- (<&) :: Monad m => Wire s e m a (Event b) -> Wire s e m a (Event b) -> Wire s e m a (Event b)
- (&>) :: Monad m => Wire s e m a (Event b) -> Wire s e m a (Event b) -> Wire s e m a (Event b)
- dropE :: Int -> Wire s e m (Event a) (Event a)
- dropWhileE :: (a -> Bool) -> Wire s e m (Event a) (Event a)
- filterE :: (a -> Bool) -> Wire s e m (Event a) (Event a)
- merge :: (a -> a -> a) -> Event a -> Event a -> Event a
- mergeL :: Event a -> Event a -> Event a
- mergeR :: Event a -> Event a -> Event a
- notYet :: Wire s e m (Event a) (Event a)
- once :: Wire s e m (Event a) (Event a)
- takeE :: Int -> Wire s e m (Event a) (Event a)
- takeWhileE :: (a -> Bool) -> Wire s e m (Event a) (Event a)
- accumE :: (b -> a -> b) -> b -> Wire s e m (Event a) (Event b)
- accum1E :: (a -> a -> a) -> Wire s e m (Event a) (Event a)
- iterateE :: a -> Wire s e m (Event (a -> a)) (Event a)
- maximumE :: Ord a => Wire s e m (Event a) (Event a)
- minimumE :: Ord a => Wire s e m (Event a) (Event a)
- productE :: Num a => Wire s e m (Event a) (Event a)
- sumE :: Num a => Wire s e m (Event a) (Event a)

# Events

Denotes a stream of values, each together with time of occurrence.
Since `Event`

is commonly used for functional reactive programming it
does not define most of the usual instances to protect continuous
time and discrete event occurrence semantics.

# Time-based

At the given point in time.

- Depends: now when occurring.

periodic :: HasTime t s => t -> Wire s e m a (Event a) Source #

Periodic occurrence with the given time period. First occurrence is now.

- Depends: now when occurring.

periodicList :: HasTime t s => t -> [b] -> Wire s e m a (Event b) Source #

Periodic occurrence with the given time period. First occurrence is now. The event values are picked one by one from the given list. When the list is exhausted, the event does not occur again.

# Signal analysis

became :: (a -> Bool) -> Wire s e m a (Event a) Source #

Occurs each time the predicate becomes true for the input signal, for example each time a given threshold is reached.

- Depends: now.

noLonger :: (a -> Bool) -> Wire s e m a (Event a) Source #

Occurs each time the predicate becomes false for the input signal, for example each time a given threshold is no longer exceeded.

- Depends: now.

edge :: (a -> Bool) -> Wire s e m a (Event a) Source #

Events occur first when the predicate is false then when it is true, and then this pattern repeats.

- Depends: now.

# Modifiers

(<&) :: Monad m => Wire s e m a (Event b) -> Wire s e m a (Event b) -> Wire s e m a (Event b) infixl 5 Source #

Merge events with the leftmost event taking precedence. Equivalent
to using the monoid interface with `First`

. Infixl 5.

- Depends: now on both.
- Inhibits: when any of the two wires inhibit.

(&>) :: Monad m => Wire s e m a (Event b) -> Wire s e m a (Event b) -> Wire s e m a (Event b) infixl 5 Source #

Merge events with the rightmost event taking precedence.
Equivalent to using the monoid interface with `Last`

. Infixl 5.

- Depends: now on both.
- Inhibits: when any of the two wires inhibit.

dropE :: Int -> Wire s e m (Event a) (Event a) Source #

Forget the first given number of occurrences.

- Depends: now.

dropWhileE :: (a -> Bool) -> Wire s e m (Event a) (Event a) Source #

Forget all initial occurrences until the given predicate becomes false.

- Depends: now.

filterE :: (a -> Bool) -> Wire s e m (Event a) (Event a) Source #

Forget all occurrences for which the given predicate is false.

- Depends: now.

merge :: (a -> a -> a) -> Event a -> Event a -> Event a Source #

Merge two events using the given function when both occur at the same time.

once :: Wire s e m (Event a) (Event a) Source #

Forget all occurrences except the first.

- Depends: now when occurring.

takeE :: Int -> Wire s e m (Event a) (Event a) Source #

Forget all but the first given number of occurrences.

- Depends: now.

takeWhileE :: (a -> Bool) -> Wire s e m (Event a) (Event a) Source #

Forget all but the initial occurrences for which the given predicate is true.

- Depends: now.

# Scans

Left scan for events. Each time an event occurs, apply the given function.

- Depends: now.

Left scan for events with no initial value. Each time an event occurs, apply the given function. The first event is produced unchanged.

- Depends: now.

iterateE :: a -> Wire s e m (Event (a -> a)) (Event a) Source #

On each occurrence, apply the function the event carries.

- Depends: now.