Stability | experimental |
---|---|

Maintainer | dwc@cs.yale.edu |

Safe Haskell | None |

MSF is a monadic signal function.

- data MSF m a b = MSF {}
- source :: Monad m => m c -> MSF m () c
- sink :: Monad m => (b -> m ()) -> MSF m b ()
- pipe :: Monad m => (b -> m c) -> MSF m b c
- sourceE :: Monad m => m c -> MSF m (Maybe ()) (Maybe c)
- sinkE :: Monad m => (b -> m ()) -> MSF m (Maybe b) (Maybe ())
- pipeE :: Monad m => (b -> m c) -> MSF m (Maybe b) (Maybe c)
- initialAction :: Monad m => m x -> (x -> MSF m a b) -> MSF m a b
- listSource :: Monad m => [c] -> MSF m () c
- stepMSF :: Monad m => MSF m a b -> [a] -> m [b]
- stepMSF' :: Monad m => MSF m a b -> [a] -> m ([b], MSF m a b)
- data Stream m b = Stream {}
- streamMSF :: Monad m => MSF m a b -> [a] -> Stream m b
- runMSF :: Monad m => a -> MSF m a b -> m b
- runMSF' :: Monad m => MSF m () b -> m b

# Documentation

The MSF data type describes a monadic signal function. Essentially, it is a Kleisli automaton, but we define it explicitly here.

# MSF Constructors

The source, sink, and pipe functions allow one to lift a monadic action to the MSF data type.

The sourceE, sinkE, and pipeE functions allow one to lift a monadic action to the MSF data type in event form.

initialAction :: Monad m => m x -> (x -> MSF m a b) -> MSF m a bSource

This function first performs a monadic action and then uses the result of that action to complete the MSF.

listSource :: Monad m => [c] -> MSF m () cSource

This function creates a MSF source based on an infinite list.

# Running MSF

stepMSF :: Monad m => MSF m a b -> [a] -> m [b]Source

This steps through the given MSF using the [a] as inputs. The result is [b] in the monad.

stepMSF' :: Monad m => MSF m a b -> [a] -> m ([b], MSF m a b)Source

This is the same as `stepMSF`

but additionally returns the
next computation.

The stream data type is used to "stream" the results of running an MSF.