Safe Haskell | None |
---|---|
Language | Haskell2010 |
- type SyncSF m cl a b = MSF (ReaderT (TimeInfo cl) m) a b
- type Behaviour m td a = forall cl. td ~ TimeDomainOf cl => SyncSF m cl () a
- type Behavior m td a = Behaviour m td a
- hoistSyncSF :: (Monad m1, Monad m2) => (forall c. m1 c -> m2 c) -> SyncSF m1 cl a b -> SyncSF m2 (HoistClock m1 m2 cl) a b
- timeless :: Monad m => MSF m a b -> SyncSF m cl a b
- arrMSync :: Monad m => (a -> m b) -> SyncSF m cl a b
- arrMSync_ :: Monad m => m b -> SyncSF m cl a b
- timeInfo :: Monad m => SyncSF m cl a (TimeInfo cl)
- timeInfoOf :: Monad m => (TimeInfo cl -> b) -> SyncSF m cl a b
- (>->) :: Monad m => SyncSF m cl a b -> SyncSF m cl b c -> SyncSF m cl a c
- (<-<) :: Monad m => SyncSF m cl b c -> SyncSF m cl a b -> SyncSF m cl a c
- arr_ :: Arrow a => b -> a c b
- syncId :: Monad m => SyncSF m cl a a
- integralFrom :: (Monad m, VectorSpace v, Groundfield v ~ Diff (TimeDomainOf cl)) => v -> SyncSF m cl v v
- integral :: (Monad m, VectorSpace v, Groundfield v ~ Diff (TimeDomainOf cl)) => SyncSF m cl v v
- derivativeFrom :: (Monad m, VectorSpace v, Groundfield v ~ Diff (TimeDomainOf cl)) => v -> SyncSF m cl v v
- derivative :: (Monad m, VectorSpace v, Groundfield v ~ Diff (TimeDomainOf cl)) => SyncSF m cl v v
- averageFrom :: (Monad m, VectorSpace v, Groundfield v ~ Diff (TimeDomainOf cl)) => v -> Diff (TimeDomainOf cl) -> SyncSF m cl v v
- average :: (Monad m, VectorSpace v, Groundfield v ~ Diff (TimeDomainOf cl)) => Diff (TimeDomainOf cl) -> SyncSF m cl v v
Synchronous signal functions and behaviours
type SyncSF m cl a b = MSF (ReaderT (TimeInfo cl) m) a b Source #
A (synchronous) monadic stream function
with the additional side effect of being time-aware,
that is, reading the current TimeInfo
of the clock cl
.
type Behaviour m td a = forall cl. td ~ TimeDomainOf cl => SyncSF m cl () a Source #
A (side-effectful) behaviour is a time-aware stream
that doesn't depend on a particular clock.
td
denotes the time domain.
Utilities to create SyncSF
s from simpler data
hoistSyncSF :: (Monad m1, Monad m2) => (forall c. m1 c -> m2 c) -> SyncSF m1 cl a b -> SyncSF m2 (HoistClock m1 m2 cl) a b Source #
Hoist a SyncSF
along a monad morphism.
timeless :: Monad m => MSF m a b -> SyncSF m cl a b Source #
A monadic stream function without dependency on time
is a SyncSF
for any clock.
arrMSync :: Monad m => (a -> m b) -> SyncSF m cl a b Source #
Utility to lift Kleisli arrows directly to SyncSF
s.
timeInfo :: Monad m => SyncSF m cl a (TimeInfo cl) Source #
Read the environment variable, i.e. the TimeInfo
.
timeInfoOf :: Monad m => (TimeInfo cl -> b) -> SyncSF m cl a b Source #
Utility to apply functions to the current TimeInfo
,
such as record selectors:
printAbsoluteTime :: SyncSF IO cl () ()
printAbsoluteTime = timeInfoOf absolute >>> arrMSync print
Useful aliases
(>->) :: Monad m => SyncSF m cl a b -> SyncSF m cl b c -> SyncSF m cl a c infixr 4 Source #
Alias for >>>
(sequential composition)
with higher operator precedence, designed to work with the other operators, e.g.:
syncsf1 >-> syncsf2 @@ clA **@ sched @** syncsf3 >-> syncsf4 @@ clB
(<-<) :: Monad m => SyncSF m cl b c -> SyncSF m cl a b -> SyncSF m cl a c infixl 4 Source #
Alias for <<<
.
arr_ :: Arrow a => b -> a c b Source #
Output a constant value. Specialises e.g. to this type signature:
arr_ :: Monad m => b -> SyncSF m cl a b
Basic signal processing components
integralFrom :: (Monad m, VectorSpace v, Groundfield v ~ Diff (TimeDomainOf cl)) => v -> SyncSF m cl v v Source #
The output of integralFrom v0
is the numerical Euler integral
of the input, with initial offset v0
.
integral :: (Monad m, VectorSpace v, Groundfield v ~ Diff (TimeDomainOf cl)) => SyncSF m cl v v Source #
Euler integration, with zero initial offset.
derivativeFrom :: (Monad m, VectorSpace v, Groundfield v ~ Diff (TimeDomainOf cl)) => v -> SyncSF m cl v v Source #
The output of derivativeFrom v0
is the numerical derivative of the input,
with a Newton difference quotient.
The input is initialised with v0
.
derivative :: (Monad m, VectorSpace v, Groundfield v ~ Diff (TimeDomainOf cl)) => SyncSF m cl v v Source #
Numerical derivative with input initialised to zero.
:: (Monad m, VectorSpace v, Groundfield v ~ Diff (TimeDomainOf cl)) | |
=> v | The initial position |
-> Diff (TimeDomainOf cl) | The time scale on which the signal is averaged |
-> SyncSF m cl v v |
An average, or low pass. It will average out, or filter, all features below a given time scale.
:: (Monad m, VectorSpace v, Groundfield v ~ Diff (TimeDomainOf cl)) | |
=> Diff (TimeDomainOf cl) | The time scale on which the signal is averaged |
-> SyncSF m cl v v |
An average, or low pass, initialised to zero.