# ¤ monadSP, SPm, et al

## Types

monadSP :: SPm `a` `b` () -> SP `a` `b`
**type** SPm `a` `b` `c` = Mk (SP `a` `b`) `c`
putSPm :: `a` -> SPm `b` `a` ()
putsSPm :: [`a`] -> SPm `b` `a` ()
getSPm :: SPm `a` `b` `a`
nullSPm :: SPm `a` `b` ()
unitSPm :: `a` -> SPm `b` `c` `a`
bindSPm :: SPm `a` `b` `c` -> (`c` -> SPm `a` `b` `d`) -> SPm `a` `b` `d`
thenSPm :: SPm `a` `b` () -> SPm `a` `b` `c` -> SPm `a` `b` `c`
toSPm :: SP `a` `b` -> SPm `a` `b` ()

## Description

Monadic style stream processor combinators.
A monadic stream processor of type `SPm inp outp ans`

is a stream processor
that inputs messages of type `inp`

, output messages of type `outp`

(like a stream processor of type `SP inp outp`

) and produces a final
result of type `ans`

.

`unitSPm`

and `bindSPm`

are the unit and bind operations of the
monad. `unitSPm x`

is a stream processor that immediately returns
the result `x`

, without performing any I/O operations.

The operations `putSPm`

, `getSPm`

and `nullSPm`

correspond
to the ordinary stream processor operations `putSP`

, `getSP`

and `nullSP`

respectively.

`monadSP`

allows a monadic stream processor to be used in any context
where an ordinary stream procesor is required.

## Bugs

Incomplete documentation.

## See Also

Continuation style stream processor operations:
SP, putSP, getSP, nullSP.
Monadic stream processors with state: SPms.