[Haskell] ANNOUNCE: CC-delcont-0.1; Delimited continuations for Haskell

Dan Doel dan.doel at gmail.com
Sun Jul 15 06:41:56 EDT 2007


After a bit of hacking, and much documenting, I'm pleased to announce a 
preliminary release of a delimited continuation library for Haskell.

The implementation is drawn from "A Monadic Framework for Delimited 
Continuations"[1] by Dybvig, Petyon Jones and Sabry, although it has some 
abstraction available over said implementation (there is both a monad and a 
transformer; control operations will work interchangeably with either. In 
addition, all four control operators from "Shift to Control"[2] are 

In addition, I have done the adaptation necessary to include the Haskell 
implementation of the dynamic scoping investigated in "Delimited Dynamic 
Binding"[3] by Kiselyov, Shan and Sabry, and it has been included. One can 
think of it as embeddings of the reader or state monads into the delimited 
control monads (only more flexible).

In the future, I'd like to also, possibly, include something like Oleg's 
generic zippers, and possibly other useful abstractions based on delimited 
continuations, if I find them. But that's work for another day, I suppose.

If you wish to try it out, a package is available on hackage:


However, I should warn that it's fairly dependent on GHC HEAD at the moment:

1) It uses the Unsafe.Coerce module
2) It uses GADTs to store type class evidence
3) It uses GHC-features that haddock will choke on, so haddock.ghc will be 
required for docs (and I haven't gotten that working yet to check that the 
haddock is bug-free), which in turn requires GHC HEAD.

1 & 2 could be relaxed if there's interest.

Please feel free to let me know if you find any bugs, or have any suggestions 
for improvements.

I'll follow up this message with a message containing an example program and a 
discussion thereof.

Dan Doel

1: http://www.cs.indiana.edu/~sabry/papers/monadicDC.pdf
2: http://www.cs.rutgers.edu/~ccshan/recur/recur.pdf
3: http://okmij.org/ftp/papers/DDBinding.pdf

More information about the Haskell mailing list