Coroutines for OCaml

This page contains implementations of coroutines in OCaml corresponding to the paper Deriving Type Systems and Implementations for Coroutines by Konrad Anton and Peter Thiemann, submitted to APLAS 2010.


For all the code on this page, you will need Oleg Kiselyov's caml-shift package and a version of OCaml which works with caml-shift.

Evolution of a coroutine interpreter

The source code in coro-combined.ml contains the intermediate artifacts of the transformation from reduction semantics for a lambda-calculus with coroutines to a direct-style interpreter with control operators. The code in coro-continuation-reader.ml contains a fork off the above development (introducing the reader monad) to establish the foundation of the translation in the paper.


OCoro is an implementation of full asymmetric and symmetric coroutines in OCaml. It comes with examples. Download ocoro-0.1.tar.gz.

Extended version of TFP 2010 paper

The extended version of Typing Coroutines contains proofs which had to be omitted from our submission to TFP 2010.


If you have questions or remarks, please contact Peter Thiemann, thiemann@informatik....