reactive-banana-bunch-1.0.0.1: Extend reactive-banana to multiple events per time point

Safe HaskellNone
LanguageHaskell98

Reactive.Banana.Bunch.Combinators

Synopsis

Documentation

data Event a Source #

Instances
Functor Event Source # 
Instance details

Defined in Reactive.Banana.Bunch.Private

Methods

fmap :: (a -> b) -> Event a -> Event b #

(<$) :: a -> Event b -> Event a #

data Behavior a #

Behavior a represents a value that varies in time. Semantically, you can think of it as a function

type Behavior a = Time -> a

Instances
Functor Behavior

The function fmap applies a function f at every point in time. Semantically,

fmap :: (a -> b) -> Behavior a -> Behavior b
fmap f b = \time -> f (b time)
Instance details

Defined in Reactive.Banana.Types

Methods

fmap :: (a -> b) -> Behavior a -> Behavior b #

(<$) :: a -> Behavior b -> Behavior a #

Applicative Behavior

The function pure returns a value that is constant in time. Semantically,

pure     :: a -> Behavior a
pure x    = \time -> x

The combinator <*> applies a time-varying function to a time-varying value.

(<*>)    :: Behavior (a -> b) -> Behavior a -> Behavior b
fx <*> bx = \time -> fx time $ bx time
Instance details

Defined in Reactive.Banana.Types

Methods

pure :: a -> Behavior a #

(<*>) :: Behavior (a -> b) -> Behavior a -> Behavior b #

liftA2 :: (a -> b -> c) -> Behavior a -> Behavior b -> Behavior c #

(*>) :: Behavior a -> Behavior b -> Behavior b #

(<*) :: Behavior a -> Behavior b -> Behavior a #

class MonadFix m => MonadMoment (m :: * -> *) where #

An instance of the MonadMoment class denotes a computation that happens at one particular moment in time. Unlike the Moment monad, it need not be pure anymore.

Minimal complete definition

liftMoment

Methods

liftMoment :: Moment a -> m a #

Instances
MonadMoment Moment 
Instance details

Defined in Reactive.Banana.Types

Methods

liftMoment :: Moment a -> Moment a #

MonadMoment MomentIO 
Instance details

Defined in Reactive.Banana.Types

Methods

liftMoment :: Moment a -> MomentIO a #

apply :: Behavior (a -> b) -> Event a -> Event b Source #

(<@>) :: Behavior (a -> b) -> Event a -> Event b infixl 4 Source #

union :: Event a -> Event a -> Event a Source #

filterE :: (a -> Bool) -> Event a -> Event a Source #

accumB :: MonadMoment m => a -> Event (a -> a) -> m (Behavior a) Source #

accumE :: MonadMoment m => a -> Event (a -> a) -> m (Event a) Source #

mapAccum :: MonadMoment m => acc -> Event (acc -> (x, acc)) -> m (Event x, Behavior acc) Source #

stepper :: MonadMoment m => a -> Event a -> m (Behavior a) Source #

valueBLater :: MonadMoment m => Behavior a -> m a #

Obtain the value of the Behavior at a given moment in time. Semantically, it corresponds to

valueBLater b = \time -> b time

Note: To allow for more recursion, the value is returned lazily and not available for pattern matching immediately. It can be used safely with most combinators like stepper. If that doesn't work for you, please use valueB instead.

collect :: Event a -> Event (T [] a) Source #

spill :: Event (T [] a) -> Event a Source #