reactive-banana-0.7.1.3: Practical library for functional reactive programming (FRP).

Safe HaskellNone

Reactive.Banana.Switch

Contents

Synopsis

Synopsis

Dynamic event switching.

Moment monad

data Moment t a Source

The Moment monad denotes a value at a particular moment in time.

This monad is not very interesting, it is mainly used for book-keeping. In particular, the type parameter t is used to disallow various unhealthy programs.

This monad is also used to describe event networks in the Reactive.Banana.Frameworks module. This only happens when the type parameter t is constrained by the Frameworks class.

To be precise, an expression of type Moment t a denotes a value of type a that is observed at a moment in time which is indicated by the type parameter t.

data AnyMoment f a Source

Value present at any/every moment in time.

anyMoment :: (forall t. Moment t (f t a)) -> AnyMoment f aSource

now :: AnyMoment f a -> forall t. Moment t (f t a)Source

Dynamic event switching

trimE :: Event t a -> Moment t (AnyMoment Event a)Source

Trim an Event to a variable start time.

trimB :: Behavior t a -> Moment t (AnyMoment Behavior a)Source

Trim a Behavior to a variable start time.

switchE :: forall t a. Event t (AnyMoment Event a) -> Event t aSource

Dynamically switch between Event.

switchB :: forall t a. Behavior t a -> Event t (AnyMoment Behavior a) -> Behavior t aSource

Dynamically switch between Behavior.

observeE :: Event t (AnyMoment Identity a) -> Event t aSource

Observe a value at those moments in time where event occurrences happen.

valueB :: Behavior t a -> Moment t aSource

Obtain the value of the Behavior at moment t.

Identity Functor

newtype Identity t a Source

Identity functor with a dummy argument. Unlike Constant, this functor is constant in the second argument.

Constructors

Identity 

Fields

getIdentity :: a