rhine-1.3: Functional Reactive Programming with type-level clocks
Safe HaskellSafe-Inferred
LanguageHaskell2010

FRP.Rhine.ClSF.Core

Description

The core functionality of clocked signal functions, supplying the type of clocked signal functions itself (ClSF), behaviours (clock-independent/polymorphic signal functions), and basic constructions of ClSFs that may use awareness of time as an effect.

Synopsis

Documentation

type ClSF m cl a b = Automaton (ReaderT (TimeInfo cl) m) a b Source #

A (synchronous, clocked) automaton with the additional side effect of being time-aware, that is, reading the current TimeInfo of the clock cl.

type ClSignal m cl a = forall arbitrary. ClSF m cl arbitrary a Source #

A clocked signal is a ClSF with no input required. It produces its output on its own.

type Behaviour m time a = forall cl. time ~ Time cl => ClSignal m cl a Source #

A (side-effectful) behaviour is a time-aware stream that doesn't depend on a particular clock. time denotes the TimeDomain.

type Behavior m time a = Behaviour m time a Source #

Compatibility to U.S. american spelling.

type BehaviourF m time a b = forall cl. time ~ Time cl => ClSF m cl a b Source #

A (side-effectful) behaviour function is a time-aware synchronous stream function that doesn't depend on a particular clock. time denotes the TimeDomain.

type BehaviorF m time a b = BehaviourF m time a b Source #

Compatibility to U.S. american spelling.

mapMaybe :: Monad m => ClSF m cl a b -> ClSF m cl (Maybe a) (Maybe b) Source #

Call a ClSF every time the input is 'Just a'.

Caution: This will not change the time differences since the last tick. For example, while integrate 1 is approximately the same as timeInfoOf sinceInit, mapMaybe $ integrate 1 is very different from mapMaybe $ timeInfoOf sinceInit. The former only integrates when the input is Just 1, whereas the latter always returns the correct time since initialisation.

hoistClSF :: (Monad m1, Monad m2) => (forall c. m1 c -> m2 c) -> ClSF m1 cl a b -> ClSF m2 cl a b Source #

Hoist a ClSF along a monad morphism.

hoistClSFAndClock :: (Monad m1, Monad m2) => (forall c. m1 c -> m2 c) -> ClSF m1 cl a b -> ClSF m2 (HoistClock m1 m2 cl) a b Source #

Hoist a ClSF and its clock along a monad morphism.

liftClSF :: (Monad m, MonadTrans t, Monad (t m)) => ClSF m cl a b -> ClSF (t m) cl a b Source #

Lift a ClSF into a monad transformer.

liftClSFAndClock :: (Monad m, MonadTrans t, Monad (t m)) => ClSF m cl a b -> ClSF (t m) (LiftClock m t cl) a b Source #

Lift a ClSF and its clock into a monad transformer.

timeless :: Monad m => Automaton m a b -> ClSF m cl a b Source #

An automaton without dependency on time is a ClSF for any clock.

arrMCl :: Monad m => (a -> m b) -> ClSF m cl a b Source #

Utility to lift Kleisli arrows directly to ClSFs.

constMCl :: Monad m => m b -> ClSF m cl a b Source #

Version without input.