|
|
|
|
|
Description |
This module contains the classic stream transformer arrow, defined by
newtype SF a b = SF { unSF :: a -> (b, SF a b) }
together with the standard (and some not-that-standard) combinators.
In particular, we take the viewpoint that each operation for products (pairs)
have to have a dual for sums (Either). Unfortunately, the Arrow class breaks
this symmetry: It favours products by putting the lifting of pure functions
there, which should in a separate class instead (there are interesting arrows without
meaningful lifting from Haskell functions).
|
|
Synopsis |
|
newtype SF a b = SF {} | | runSF :: SF a b -> [a] -> [b] | | sf_id :: SF a a | | sf_comp :: SF a b -> SF b c -> SF a c | | sf_arr :: (a -> b) -> SF a b | | sf_first :: SF a b -> SF (a, x) (b, x) | | sf_second :: SF a b -> SF (x, a) (x, b) | | sf_left :: SF a b -> SF (Either a x) (Either b x) | | sf_right :: SF a b -> SF (Either x a) (Either x b) | | sf_loop :: SF (a, s) (b, s) -> SF a b | | sf_eitherLoop :: SF (Either a c) (Either b c) -> SF a b | | sf_init :: a -> SF a a | | sf_loopD :: s -> ((a, s) -> (b, s)) -> SF a b | | sf_mealy_ :: s -> (a -> s -> (b, s)) -> SF a b | | sf_mealy :: s -> (a -> s -> (b, s)) -> SF a (b, s) | | sf_eitherMachine :: s -> (Either a s -> Either b s) -> SF a b | | sf_delta :: SF a (a, a) | | sf_merge :: SF (Either a a) a | | sf_compMaybe :: SF a (Maybe b) -> SF b c -> SF a (Maybe c) | | sf_liftMaybe :: SF a b -> SF (Maybe a) (Maybe b) | | sf_justA :: SF a (Maybe a) | | sf_nothingA :: SF x (Maybe a) |
|
|
Documentation |
|
|
Constructors | | Instances | |
|
|
|
|
Category
|
|
|
|
|
|
Lift
|
|
|
|
Products
|
|
|
|
|
|
Sums
|
|
|
|
|
|
Loop (product)
|
|
|
|
Loop (sum)
|
|
|
The dual of loop.
|
|
Delay
|
|
|
An initialized delay.
|
|
sf_loopD :: s -> ((a, s) -> (b, s)) -> SF a b | Source |
|
Loop with delay (that is, a state machine).
|
|
State machine
|
|
sf_mealy_ :: s -> (a -> s -> (b, s)) -> SF a b | Source |
|
This is actually equivalent to sf_loopD.
|
|
sf_mealy :: s -> (a -> s -> (b, s)) -> SF a (b, s) | Source |
|
|
|
This is the dual of sf_loopD. It looks a bit strange, but basically what
happens is that state transitions happen only when then input triggers them,
and meantime it is sleeping, remembering the old state. The new state will
depend only on the input when the transition was triggered, and the new output
will depend on the old state.
|
|
Delta / merge
|
|
|
These are actually pure functions.
|
|
|
|
Maybe
|
|
|
|
|
|
|
This is a pure function, too.
|
|
|
|
Produced by Haddock version 2.6.1 |