Safe Haskell | None |
---|---|

Language | Haskell98 |

- class (MonadHold t (PushM t), MonadSample t (PullM t), MonadFix (PushM t), Functor (Event t), Functor (Behavior t)) => Reflex t where
- class (Applicative m, Monad m) => MonadSample t m | m -> t where
- class MonadSample t m => MonadHold t m where
- newtype EventSelector t k = EventSelector {}
- pushAlways :: Reflex t => (a -> PushM t b) -> Event t a -> Event t b
- ffor :: Functor f => f a -> (a -> b) -> f b
- class FunctorMaybe f where
- fforMaybe :: FunctorMaybe f => f a -> (a -> Maybe b) -> f b
- ffilter :: FunctorMaybe f => (a -> Bool) -> f a -> f a
- zipListWithEvent :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> c) -> [a] -> Event t b -> m (Event t c)
- tag :: Reflex t => Behavior t b -> Event t a -> Event t b
- attach :: Reflex t => Behavior t a -> Event t b -> Event t (a, b)
- attachWith :: Reflex t => (a -> b -> c) -> Behavior t a -> Event t b -> Event t c
- attachWithMaybe :: Reflex t => (a -> b -> Maybe c) -> Behavior t a -> Event t b -> Event t c
- onceE :: (Reflex t, MonadHold t m, MonadFix m) => Event t a -> m (Event t a)
- headE :: (Reflex t, MonadHold t m, MonadFix m) => Event t a -> m (Event t a)
- tailE :: (Reflex t, MonadHold t m, MonadFix m) => Event t a -> m (Event t a)
- headTailE :: (Reflex t, MonadHold t m, MonadFix m) => Event t a -> m (Event t a, Event t a)
- splitE :: Reflex t => Event t (a, b) -> (Event t a, Event t b)
- traceEvent :: (Reflex t, Show a) => String -> Event t a -> Event t a
- traceEventWith :: Reflex t => (a -> String) -> Event t a -> Event t a
- data EitherTag l r a where
- eitherToDSum :: Either a b -> DSum (EitherTag a b) Identity
- dsumToEither :: DSum (EitherTag a b) Identity -> Either a b
- dmapToThese :: DMap (EitherTag a b) Identity -> Maybe (These a b)
- appendEvents :: (Reflex t, Monoid a) => Event t a -> Event t a -> Event t a
- sequenceThese :: Monad m => These (m a) (m b) -> m (These a b)
- mergeWith :: Reflex t => (a -> a -> a) -> [Event t a] -> Event t a
- leftmost :: Reflex t => [Event t a] -> Event t a
- mergeList :: Reflex t => [Event t a] -> Event t (NonEmpty a)
- mergeMap :: (Reflex t, Ord k) => Map k (Event t a) -> Event t (Map k a)
- fanMap :: (Reflex t, Ord k) => Event t (Map k a) -> EventSelector t (Const2 k a)
- switchPromptly :: forall t m a. (Reflex t, MonadHold t m) => Event t a -> Event t (Event t a) -> m (Event t a)
- gate :: Reflex t => Behavior t Bool -> Event t a -> Event t a
- switcher :: (Reflex t, MonadHold t m) => Behavior t a -> Event t (Behavior t a) -> m (Behavior t a)

# Documentation

class (MonadHold t (PushM t), MonadSample t (PullM t), MonadFix (PushM t), Functor (Event t), Functor (Behavior t)) => Reflex t where Source #

data Behavior t :: * -> * Source #

A container for a value that can change over time. Behaviors can be sampled at will, but it is not possible to be notified when they change

data Event t :: * -> * Source #

A stream of occurrences. During any given frame, an Event is either occurring or not occurring; if it is occurring, it will contain a value of the given type (its "occurrence type")

type PushM t :: * -> * Source #

A monad for doing complex push-based calculations efficiently

type PullM t :: * -> * Source #

A monad for doing complex pull-based calculations efficiently

An Event with no occurrences

constant :: a -> Behavior t a Source #

Create a Behavior that always has the given value

push :: (a -> PushM t (Maybe b)) -> Event t a -> Event t b Source #

Create an Event from another Event; the provided function can sample Behaviors and hold Events, and use the results to produce a occurring (Just) or non-occurring (Nothing) result

pull :: PullM t a -> Behavior t a Source #

Create a Behavior by reading from other Behaviors; the result will be recomputed whenever any of the read Behaviors changes

merge :: GCompare k => DMap k (Event t) -> Event t (DMap k Identity) Source #

Merge a collection of events; the resulting Event will only occur if at least one input event is occuring, and will contain all of the input keys that are occurring simultaneously

fan :: GCompare k => Event t (DMap k Identity) -> EventSelector t k Source #

Efficiently fan-out an event to many destinations. This function should be partially applied, and then the result applied repeatedly to create child events

switch :: Behavior t (Event t a) -> Event t a Source #

Create an Event that will occur whenever the currently-selected input Event occurs

coincidence :: Event t (Event t a) -> Event t a Source #

Create an Event that will occur whenever the input event is occurring and its occurrence value, another Event, is also occurring

class (Applicative m, Monad m) => MonadSample t m | m -> t where Source #

MonadSample Spider ReadPhase Source # | |

MonadSample Spider SpiderHostFrame Source # | |

MonadSample Spider SpiderHost Source # | |

MonadSample Spider EventM Source # | |

MonadSample Spider BehaviorM Source # | |

MonadSample t m => MonadSample t (ExceptT e m) Source # | |

MonadSample t m => MonadSample t (StateT s m) Source # | |

(MonadSample t m, Monoid r) => MonadSample t (WriterT r m) Source # | |

MonadSample t m => MonadSample t (ContT * r m) Source # | |

MonadSample t m => MonadSample t (ReaderT * r m) Source # | |

(MonadSample t m, Monoid w) => MonadSample t (RWST r w s m) Source # | |

class MonadSample t m => MonadHold t m where Source #

hold :: a -> Event t a -> m (Behavior t a) Source #

Create a new Behavior whose value will initially be equal to the given value and will be updated whenever the given Event occurs. The update takes effect immediately after the Event occurs; if the occurrence that sets the Behavior (or one that is simultaneous with it) is used to sample the Behavior, it will see the *old* value of the Behavior, not the new one.

MonadHold Spider ReadPhase Source # | |

MonadHold Spider SpiderHostFrame Source # | |

MonadHold Spider SpiderHost Source # | |

MonadHold Spider EventM Source # | |

MonadHold t m => MonadHold t (ExceptT e m) Source # | |

MonadHold t m => MonadHold t (StateT s m) Source # | |

(MonadHold t m, Monoid r) => MonadHold t (WriterT r m) Source # | |

MonadHold t m => MonadHold t (ContT * r m) Source # | |

MonadHold t m => MonadHold t (ReaderT * r m) Source # | |

(MonadHold t m, Monoid w) => MonadHold t (RWST r w s m) Source # | |

newtype EventSelector t k Source #

class FunctorMaybe f where Source #

A class for values that combines filtering and mapping using `Maybe`

.

Reflex t => FunctorMaybe (Event t) Source # | |

ffilter :: FunctorMaybe f => (a -> Bool) -> f a -> f a Source #

Filter 'f a' using the provided predicate.
Relies on `fforMaybe`

.

zipListWithEvent :: (Reflex t, MonadHold t m, MonadFix m) => (a -> b -> c) -> [a] -> Event t b -> m (Event t c) Source #

attachWithMaybe :: Reflex t => (a -> b -> Maybe c) -> Behavior t a -> Event t b -> Event t c Source #

onceE :: (Reflex t, MonadHold t m, MonadFix m) => Event t a -> m (Event t a) Source #

Alias for `headE`

headTailE :: (Reflex t, MonadHold t m, MonadFix m) => Event t a -> m (Event t a, Event t a) Source #

eitherToDSum :: Either a b -> DSum (EitherTag a b) Identity Source #

Convert `Either`

to a `DSum`

. Inverse of `dsumToEither`

.

dsumToEither :: DSum (EitherTag a b) Identity -> Either a b Source #

Convert `DSum`

to `Either`

. Inverse of `eitherToDSum`

.

sequenceThese :: Monad m => These (m a) (m b) -> m (These a b) Source #

Deprecated: Use bisequenceA or bisequence from the bifunctors package instead

fanMap :: (Reflex t, Ord k) => Event t (Map k a) -> EventSelector t (Const2 k a) Source #

Split the event into an `EventSelector`

that allows efficient
selection of the individual `Event`

s.

switchPromptly :: forall t m a. (Reflex t, MonadHold t m) => Event t a -> Event t (Event t a) -> m (Event t a) Source #

Switches to the new event whenever it receives one; the new event is used immediately, on the same frame that it is switched to