Coroutines

Rita Loogen loogen@Mathematik.Uni-Marburg.de
Tue, 20 Mar 2001 16:45:52 +0100


Eden (http://www.mathematik.uni-marburg.de/inf/eden)  is a parallel
extension of Haskell that provides processes which communicate via
streams (lazy lists).
In Eden, your pseudocode would look like:

sender :: Int -> Process () [Int]
sender n = process () -> [n,n+1..]

receiver :: Process [Int] [Results]
receiver = process xs -> consume xs
               where consume :: [Int] -> [Results]

main = print  (receiver # (sender # ()))

The type Process a b belongs to a process abstraction which defines a
process consuming input of type a and producing output of type b.
# :: Process a b -> a -> b applies a process abstraction to input. This
leads to the creation of the process and its interconnecting channels.

Regards

Rita

--
Rita Loogen
Fachbereich Mathematik und Informatik, Philipps-Universitaet Marburg,
Germany
http://www.mathematik.uni-marburg.de/~loogen
--