| Stability | experimental |
|---|---|
| Maintainer | conal@conal.net |
FRP.Reactive.Internal.Behavior
Description
Representation of reactive behaviors
Documentation
newtype BehaviorG tr tf a Source
Reactive behaviors. They can be understood in terms of a simple
model (denotational semantics) as functions of time, namely at ::
BehaviorG t a -> (t -> a).
The semantics of BehaviorG instances are given by corresponding
instances for the semantic model (functions). See
http://conal.net/blog/posts/simplifying-semantics-with-type-class-morphisms/.
-
Functor:at (fmap f r) == fmap f (at r), i.e.,fmap f r.att == f (ratt) -
Applicative:at (pure a) == pure a, andat (s <*> r) == at s <*> at t. That is,pure a, andatt == a(s <*> r).att == (satt) (ratt) -
Monad:at (return a) == return a, andat (join rr) == join (at . at rr). That is,return a, andatt == ajoin rr. As always,att == (rratt)att(r >>= f) == join (fmap f r).at (r >>= f) == at r >>= at . f. -
Monoid: a typical lifted monoid. Ifois a monoid, thenReactive ois a monoid, withmempty == pure mempty, andmappend == liftA2 mappend. That is,mempty, andatt == mempty(rmappends)att == (ratt)mappend(satt).