loopSP, loopLeftSP

Stream processor combinators that create circular connections

Types

loopSP :: SP a a -> SP a a
loopLeftSP :: SP (Either a b) (Either a c) -> SP b c

Description

The loop combinators construct circular connections between stream processors. loopSP sp and loopLeftSP sp can be illustrated as:

loopSP is an untagged loop combinator. Output from sp is propagated both to the output and to the loop.

loopLeftSP is a tagged loop combinator. Output from sp is sent to the output of the composition if it is tagged Right and to the loop if it is tagged Left. Similarly, input to sp is is tagged Right if it comes from the input of the composition and tagged Left if it comes from the loop.

Example

 loopSP (sp1 `serCompSP` sp2)
This shows a way to obtain bidirectional communication between two stream processors.

See Also

Related stream processor combinators: serCompSP, compEitherSP, loopThroughRightSP.

The corresponding fudget combinators: loopF, loopLeftF.