Safe Haskell | None |
---|---|
Language | Haskell2010 |
- newtype React m a = React {
- reactively :: Producer a m ()
- merge :: (Alternative m, Monad m) => React m x -> React m y -> React m (Either (x, y) (Either (x, Maybe y) (Maybe x, y)))
- merge' :: (Alternative m, Monad m) => Maybe x -> Maybe y -> React m x -> React m y -> React m (Either (x, y) (Either (x, Maybe y) (Maybe x, y)))
Documentation
The applicative instance of this combines multiple Producers reactively ie, yields a value as soon as either or both of the input producers yields a value.
React | |
|
Monad m => Functor (React m) Source # | |
(Alternative m, Monad m) => Applicative (React m) Source # | Reactively combines two producers, given initial values to use when the producer is blocked/failed.
This only works for Alternative m where failure means there was no effects, eg. |
Wrapped (React m0 a0) Source # | |
(~) * (React m0 a0) t0 => Rewrapped (React m1 a1) t0 Source # | |
type Unwrapped (React m0 a0) Source # | |
merge :: (Alternative m, Monad m) => React m x -> React m y -> React m (Either (x, y) (Either (x, Maybe y) (Maybe x, y))) Source #
A simpler version of merge', with the initial values as Nothing
merge' :: (Alternative m, Monad m) => Maybe x -> Maybe y -> React m x -> React m y -> React m (Either (x, y) (Either (x, Maybe y) (Maybe x, y))) Source #
Reactively combines two producers, given initial values to use when the produce hasn't produced anything yet
Combine two signals, and returns a signal that emits
Either bothfired (Either (leftFired, previousRight) (previousLeft, rightFired))
.
This only works for Alternative m where failure means there was no effects, eg. STM
, or MonadTrans t => t STM
.
Be careful of monad transformers ExceptT that hides the STM Alternative instance.