Stability | experimental |
---|---|
Maintainer | conal@conal.net |
Safe Haskell | None |
FRP.Reactive.Internal.Behavior
Description
Representation of reactive behaviors
Documentation
newtype BehaviorG tr tf a
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
.at
t == f (rat
t) -
Applicative
:at (pure a) == pure a
, andat (s <*> r) == at s <*> at t
. That is,pure a
, andat
t == a(s <*> r)
.at
t == (sat
t) (rat
t) -
Monad
:at (return a) == return a
, andat (join rr) == join (at . at rr)
. That is,return a
, andat
t == ajoin rr
. As always,at
t == (rrat
t)at
t(r >>= f) == join (fmap f r)
.at (r >>= f) == at r >>= at . f
. -
Monoid
: a typical lifted monoid. Ifo
is a monoid, thenReactive o
is a monoid, withmempty == pure mempty
, andmappend == liftA2 mappend
. That is,mempty
, andat
t == mempty(r
mappend
s)at
t == (rat
t)mappend
(sat
t).
Instances
Enum a => Enum (Behavior a) | |
Eq (Behavior b) | |
Floating b => Floating (Behavior b) | |
Fractional b => Fractional (Behavior b) | |
Integral a => Integral (Behavior a) | |
Num b => Num (Behavior b) | |
Ord b => Ord (Behavior b) | |
(Num a, Ord a) => Real (Behavior a) | |
RealFloat a => RealFloat (Behavior a) | |
RealFrac a => RealFrac (Behavior a) | |
Show (Behavior b) | |
VectorSpace v => VectorSpace (Behavior v) | |
AdditiveGroup v => AdditiveGroup (Behavior v) | |
Functor (BehaviorG tr tf) | |
(Bounded tr, Ord tr) => Applicative (BehaviorG tr tf) | |
(Ord tr, Bounded tr) => Zip (BehaviorG tr tf) | |
Unzip (BehaviorG tr tf) | |
(Monoid tr, Monoid tf, Semigroup tf) => Copointed (BehaviorG tr tf) | |
(Bounded tr, Ord tr, Monoid a) => Monoid (BehaviorG tr tf a) |