- type DTime = Double
- newtype SF a b = MkSF {}
- sfId :: SF a a
- sfArr :: (a -> b) -> SF a b
- sfComp :: SF b c -> SF a b -> SF a c
- sfLoop :: SF (a, c) (b, c) -> SF a b
- sfFirst :: SF a b -> SF (a, c) (b, c)
- sfSecond :: SF a b -> SF (c, a) (c, b)
- sfLeft :: SF a b -> SF (Either a c) (Either b c)
- sfRight :: SF a b -> SF (Either c a) (Either c b)
- sfDelay :: a -> SF a a
- dTime :: SF () DTime
- class Arrow a => ArrowDelay a where
- delay :: b -> a b b

- data Event a
- switch :: SF b (c, Event d) -> (d -> SF b c) -> SF b c
- dswitch :: SF b (c, Event d) -> (d -> SF b c) -> SF b c
- kswitch :: SF a b -> SF (a, b) (Event c) -> (SF a b -> c -> SF a b) -> SF a b
- dkswitch :: SF a b -> SF (a, b) (Event c) -> (SF a b -> c -> SF a b) -> SF a b
- pswitch :: Functor col => (forall sf. a -> col sf -> col (b, sf)) -> col (SF b c) -> SF (a, col c) (Event d) -> (col (SF b c) -> d -> SF a (col c)) -> SF a (col c)
- dpswitch :: Functor col => (forall sf. a -> col sf -> col (b, sf)) -> col (SF b c) -> SF (a, col c) (Event d) -> (col (SF b c) -> d -> SF a (col c)) -> SF a (col c)
- nth :: Int -> DTime -> SF () a -> a
- gen :: SF a b -> [(DTime, a)] -> [b]

# Documentation

SF a b can be seen as a function from [x1, x2, ...] to [y1, y2, ...], in which

x1, x2, ... have the type of a, and y1, y2, ... have the type of b. Notice that

each value is in fact a sample of a continuous temporal function of values in

some certain time. The time stamps are omitted in most of the comments.

sfComp :: SF b c -> SF a b -> SF a cSource

Input of sf1: [y1, y2, ...]

Output of sf1: [z1, z2, ...]

Input of sf2: [x1, x2, ...]

Output of sf2: [y1, y2, ...]

Input: [x1, x2, ...]

Output: [z1, z2, ...]

sfLoop :: SF (a, c) (b, c) -> SF a bSource

Returns a signal function that:

Input: [x1, x2, ...]

Output: [y1, y2, ...]

whenever the following property holds for sf:

Input of sf: [(x1, z1), (x2, z2), ...]

Output of sf: [(y1, z1), (y2, z2), ...]

sfFirst :: SF a b -> SF (a, c) (b, c)Source

Input of sf: [x1, x2, ...]

Output of sf: [y1, y2, ...]

Input: [(x1, z1), (x2, z2), ...]

Output: [(y1, z1), (y2, z2), ...]

sfSecond :: SF a b -> SF (c, a) (c, b)Source

Input of sf: [x1, x2, ...]

Output of sf: [y1, y2, ...]

Input: [(z1, x1), (z2, x2), ...]

Output: [(z1, y1), (z2, y2), ...]

sfLeft :: SF a b -> SF (Either a c) (Either b c)Source

Input of sf: [x1, x2, ...]

Output of sf: [y1, y2, ...]

Input: [Left x1, Right z1, Left x2, ...]

Output: [Left y1, Right z1, Left y2, ...]

sfRight :: SF a b -> SF (Either c a) (Either c b)Source

Input of sf: [x1, x2, ...]

Output of sf: [y1, y2, ...]

Input: [Right x1, Left z1, Right x2, ...]

Output: [Right y1, Left z2, Right y2, ...]

Input of sf: [x1, x2, ...]

Output of sf: [dt1, dt2, ...] (dt_i is the time interval between x_(i-1) and x_i)

class Arrow a => ArrowDelay a whereSource

ArrowDelay SF | right, (|||) and (+++) are not necessary. They exist only for optimization |

switch :: SF b (c, Event d) -> (d -> SF b c) -> SF b cSource

Input of sf: [x1, x2, x3, ...]

Output of sf: [(y1, NoEvent), (y2, Event e1), (y3, NoEvent), ...]

Input of (gen e): [x2, x3, ...]

Output of (gen e): [y(e1)1, y(e1)2, ...]

Input: [x1, x2, x3, ...]

Output: [y1, y(e1)1, y(e1)2, ...]

dswitch :: SF b (c, Event d) -> (d -> SF b c) -> SF b cSource

Input of sf: [x1, x2, x3, ...]

Output of sf: [(y1, NoEvent), (y2, Event e1), (y3, NoEvent), ...]

Input of (gen e): [x2, x3, ...]

Output of (gen e): [y(e1)1, y(e1)2, ...]

Input: [x1, x2, x3, ...]

Output: [y1, y2, y(e1)2, ...]

kswitch :: SF a b -> SF (a, b) (Event c) -> (SF a b -> c -> SF a b) -> SF a bSource

Input of sf: [x1, x2, x3, ...]

Output of sf: [y1, y2, y3, ...]

Input of sfe: [(x1, y1), (x2, y2), (x3, y3), ...]

Output of sfe: [NoEvent, Event e1, NoEvent, ...]

Input of (gen sf3 e1): [x2, x3, ...]

Output of (gen sf3 e1): [y(sf3,e1)1, y(sf3,e1)2, ...]

Input: [x1, x2, x3, ...]

Output: [y1, y(sf3,e1)1, y(sf3,e2)2, ...]

where sf1 = [x1, x2, x3, ...] -- ^> [y1, y2, y3, ...]

sf2 = [x2, x3, ...] -- ^> [y2, y3, ...]

sf3 = [x3, ...] -- ^> [y3, ...]

...

dkswitch :: SF a b -> SF (a, b) (Event c) -> (SF a b -> c -> SF a b) -> SF a bSource

Input of sf: [x1, x2, x3, ...]

Output of sf: [y1, y2, y3, ...]

Input of sfe: [(x1, y1), (x2, y2), (x3, y3), ...]

Output of sfe: [NoEvent, Event e1, NoEvent, ...]

Input of (gen sf3 e1): [x2, x3, ...]

Output of (gen sf3 e1): [y(sf3,e1)1, y(sf3,e1)2, ...]

Input: [x1, x2, x3, ...]

Output: [y1, y2, y(sf3,e2)2, ...]

where sf1 = [x1, x2, x3, ...] -- ^> [y1, y2, y3, ...]

sf2 = [x2, x3, ...] -- ^> [y2, y3, ...]

sf3 = [x3, ...] -- ^> [y3, ...]

...

pswitch :: Functor col => (forall sf. a -> col sf -> col (b, sf)) -> col (SF b c) -> SF (a, col c) (Event d) -> (col (SF b c) -> d -> SF a (col c)) -> SF a (col c)Source

dpswitch :: Functor col => (forall sf. a -> col sf -> col (b, sf)) -> col (SF b c) -> SF (a, col c) (Event d) -> (col (SF b c) -> d -> SF a (col c)) -> SF a (col c)Source