Reactive-banana – Safe and simple semantics
The third and final approach to FRP we'll take a look at is Reactive-banana. Like Yampa, we have both continuous- and discrete-time semantics at our disposal. In Reactive-banana terminology, events describe discrete time, while behaviors describe continuous time. Behaviors in Reactive-banana are like signals in Elerea. Historically, the names
event and behavior were the first to occur:
data Event a -- instance Functor data Behavior a -- instance Functor, Applicative
Note that behavior is not Monad, unlike Elerea's signal, which did have a
Monad instance. Instead, Reactive-banana supports moments as reactive computation contexts. There is a pure Moment
monad, impure MomentIO
monad and MonadMoment
class that is used to overload moment context:
data Moment a -- instance Monad, MonadFix, MonadMoment data MomentIO a –- instance ..., MonadIO class Monad m => MonadMoment m where liftMoment :: Moment a -> m a...