rhine- Functional Reactive Programming with type-level clocks

Safe HaskellNone




data Tickable m cla clb cl clc cld a b c d Source #

A signal function (SF) enclosed by matching ResamplingBuffers and further auxiliary data, such that it can be stepped with each arriving tick from a clock cl. They play a similar role like ReactHandles in dunai.

The type parameters:




initLastTime :: SF m cl a b -> TimeDomainOf cl -> LastTime cl Source #

Initialise the tree of last tick times.

createTickable :: ResamplingBuffer m cla (Leftmost cl) a b -> SF m cl b c -> ResamplingBuffer m (Rightmost cl) cld c d -> TimeDomainOf cl -> Tickable m cla (Leftmost cl) cl (Rightmost cl) cld a b c d Source #

Initialise a Tickable from a signal function, two matching enclosing resampling buffers and an initial time.

tick Source #


:: (Monad m, Clock m cl, TimeDomainOf cla ~ TimeDomainOf cl, TimeDomainOf clb ~ TimeDomainOf cl, TimeDomainOf clc ~ TimeDomainOf cl, TimeDomainOf cld ~ TimeDomainOf cl, TimeDomainOf (Leftmost cl) ~ TimeDomainOf cl, TimeDomainOf (Rightmost cl) ~ TimeDomainOf cl) 
=> Tickable m cla clb cl clc cld a b c d 
-> TimeDomainOf cl

Timestamp of the present tick

-> Tag cl

Tag of the overall clock; contains the information which subsystem will become active

-> m (Tickable m cla clb cl clc cld a b c d) 

In this function, one tick, or step of an asynchronous signal function happens. The TimeInfo holds the information which part of the signal tree will tick. This information is encoded in the Tag of the TimeInfo, which is of type 'Either tag1 tag2' in case of a SequentialClock or a ParallelClock, encoding either a tick for the left clock or the right clock.

trivialResamplingBuffer :: Monad m => cl -> ResamplingBuffer m (Rightmost cl) (Leftmost cl) () () Source #

A ResamplingBuffer producing only units. (Slightly more efficient and direct implementation than the one in Timeless that additionally unifies the clock types in a way needed for the tick implementation.)