Safe Haskell | None |
---|---|
Language | Haskell2010 |
A simply Yampa-like library for signal functions.
Synopsis
- data SF a b
- identity :: SF a a
- compose :: SF b c -> SF a b -> SF a c
- switch :: SF a (b :* Maybe' c) -> Box (c -> SF a b) -> SF a b
- rSwitch :: SF a b -> SF (a :* Maybe' (SF a b)) b
- constant :: Stable b => b -> SF a b
- loopPre :: c -> SF (a :* c) (b :* O c) -> SF a b
- stepSF :: SF a b -> DTime -> a -> O (SF a b) :* b
- initially :: a -> SF a a
- integral :: (Stable a, VectorSpace a s) => a -> SF a a
- (-->) :: b -> SF a b -> SF a b
- (-:>) :: b -> O (SF a b) -> SF a b
- (>--) :: a -> SF a b -> SF a b
- (-=>) :: (b -> b) -> SF a b -> SF a b
- (>=-) :: (a -> a) -> SF a b -> SF a b
- (^>>) :: Arrow a => Box (b -> c) -> a c d -> a b d
- (>>^) :: Arrow a => a b c -> Box (c -> d) -> a b d
- (<<^) :: Arrow a => a c d -> Box (b -> c) -> a b d
- (^<<) :: Arrow a => Box (c -> d) -> a b c -> a b d
- module Rattus.Arrow
- (>>>) :: Category cat => cat a b -> cat b c -> cat a c
Documentation
Signal functions from inputs of type a
to outputs of type b
.
switch :: SF a (b :* Maybe' c) -> Box (c -> SF a b) -> SF a b Source #
switch s f
behaves like s
composed with arr fst
until s
produces a value of the form Just' c
in the second
component. From then on it behaves like $f c@.
rSwitch :: SF a b -> SF (a :* Maybe' (SF a b)) b Source #
rSwitch s
behaves like s
, but every time the second input is
of the form Just' s'
it will change behaviour to s'
.
loopPre :: c -> SF (a :* c) (b :* O c) -> SF a b Source #
Loop with an initial value for the signal being fed back.
Note: The type of loopPre
is different from Yampa's as we need
the O
type here.
integral :: (Stable a, VectorSpace a s) => a -> SF a a Source #
Compute the integral of a signal. The first argument is the offset.
(-->) :: b -> SF a b -> SF a b Source #
The output at time zero is the first argument, and from that point on it behaves like the signal function passed as second argument.
(-:>) :: b -> O (SF a b) -> SF a b Source #
Insert a sample in the output, and from that point on, behave like the given signal function.
Note: The type of -:> is different from Yampa's: The second argument must be delayed (or boxed).
(>--) :: a -> SF a b -> SF a b Source #
The input at time zero is the first argument, and from that point on it behaves like the signal function passed as second argument.
(-=>) :: (b -> b) -> SF a b -> SF a b Source #
Apply a function to the first output value at time zero.
(>=-) :: (a -> a) -> SF a b -> SF a b Source #
Apply a function to the first input value at time zero.
(<<^) :: Arrow a => a c d -> Box (b -> c) -> a b d Source #
Precomposition with a pure function (right-to-left variant).
(^<<) :: Arrow a => Box (c -> d) -> a b c -> a b d Source #
Postcomposition with a pure function (right-to-left variant).
module Rattus.Arrow