Copyright | (c) 2016 Ertugrul Söylemez |
---|---|
License | BSD3 |
Maintainer | Ertugrul Söylemez <esz@posteo.de> |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
- data Wire m a b
- evalWith :: Applicative m => (forall b. a -> b -> b) -> Wire m a a
- initial :: Applicative m => Wire m (m a) a
- withM :: Monad m => (s -> Wire m a b) -> (a -> m s) -> Wire m a b
- data Event a
- catMapE :: (a -> Maybe b) -> Event a -> Event b
- hold :: Applicative m => a -> Wire m (Event a) a
- hold' :: Applicative m => a -> Wire m (Event a) a
- never :: Event a
- unfoldE :: Applicative m => s -> Wire m (Event (s -> (a, s))) (Event a)
- manage :: (Traversable f, Applicative m) => f (Wire m a b) -> Wire m (a, Event (f (Wire m a b) -> f (Wire m a b))) (f b)
- manage' :: (Traversable f, Applicative m) => f (Wire m a b) -> Wire m (a, Event (f (Wire m a b) -> f (Wire m a b))) (f b)
- sequenceW :: (Traversable f, Applicative m) => f (Wire m a b) -> Wire m a (f b)
- switch :: Functor m => Wire m a (b, Event (Wire m a b)) -> Wire m a b
- switch' :: Monad m => Wire m a (b, Event (Wire m a b)) -> Wire m a b
Wires
Wire
is a language for defining reactive systems. It is similar
to the underlying monad m
, but runs continuously.
Monad m => Arrow (Wire m) Source # | |
Monad m => ArrowChoice (Wire m) Source # | |
MonadFix m => ArrowLoop (Wire m) Source # | |
Applicative m => Choice (Wire m) Source # | |
Functor m => Strong (Wire m) Source # | |
MonadFix m => Costrong (Wire m) Source # | |
Functor m => Profunctor (Wire m) Source # | |
Monad m => Category * (Wire m) Source # | |
Functor m => Functor (Wire m a) Source # | |
Applicative m => Applicative (Wire m a) Source # | |
evalWith :: Applicative m => (forall b. a -> b -> b) -> Wire m a a Source #
Evaluate the input using the given strategy in every frame. Valid
arguments include functions like seq
.
initial :: Applicative m => Wire m (m a) a Source #
Run the given action once at the beginning.
withM :: Monad m => (s -> Wire m a b) -> (a -> m s) -> Wire m a b Source #
Run the given action to initialise the given wire. Example:
withM (scan f) actionFromInitialInput
Events
An event is a timestamped stream of occurrences with payloads of the given type.
catMapE :: (a -> Maybe b) -> Event a -> Event b Source #
Map and filter event occurrences using the given function.
hold :: Applicative m => a -> Wire m (Event a) a Source #
Hold the latest occurrence of the given event starting with the given initial value. The value switch occurs in the next frame.
hold' :: Applicative m => a -> Wire m (Event a) a Source #
Hold the latest occurrence of the given event starting with the given initial value. The value switch occurs instantly.
unfoldE :: Applicative m => s -> Wire m (Event (s -> (a, s))) (Event a) Source #
Unfold the given event using the state transition functions it carries.
Switching
manage :: (Traversable f, Applicative m) => f (Wire m a b) -> Wire m (a, Event (f (Wire m a b) -> f (Wire m a b))) (f b) Source #
Sequence each of the given wires and collect their results. If the given event occurs, the its function is applied to the current set of wires. Changes are applied in the next frame.
manage' :: (Traversable f, Applicative m) => f (Wire m a b) -> Wire m (a, Event (f (Wire m a b) -> f (Wire m a b))) (f b) Source #
Sequence each of the given wires and collect their results. If the given event occurs, the its function is applied to the current set of wires. Changes are applied immediately.
sequenceW :: (Traversable f, Applicative m) => f (Wire m a b) -> Wire m a (f b) Source #
Sequence each of the given wires and collect their results.