Context Navigation

Architecture

The SCC framework is implemented in multiple layers. Lower layers are useful by themselves.

The lowest layer: trampoline-style nestable coroutines

This layer, implemented by the Control.Concurrent.Trampoline module, provides a limited coroutine functionality in Haskell. The centerpiece of the approach is the monad transformer Trampoline, that transforms an arbitrary monadic computation into a suspendable and resumable one. The basic definition is simple:

This function takes two coroutines as arguments, producer and consumer. The producer gets a sink argument, and the consumer a source argument. All data that the producer writes to the sink can be read from the source by the consumer. This arrangement couldn't be simpler.

Components and combinators

What can one do with a number of sources and sinks? The next layer tries to organize the answers. First, it defines the types of various actors on sources and sinks: