Lambda the Ultimate

inactiveTopic Devils and Angels, via Monads
started 5/11/2003; 8:39:05 AM - last post 5/12/2003; 2:53:51 AM
Ehud Lamm - Devils and Angels, via Monads  blueArrow
5/11/2003; 8:39:05 AM (reads: 2188, responses: 1)
Devils and Angels, via Monads
(on comp.lang.scheme)

This note reminisces on a paper by Dan Friedman (with Haynes and Kohlbecker, 1984): "Programming with Continuations". That paper used call/cc and mutable state (via "set!") to describe an "exercise", which they called "devils and angels". This "exercise" has little practical point, per se: it is really the illustration of the combination of state and first-class continuations which was important...

This note shows an alternative implementation: in terms of monads: a state monad lifted into a continuation monad...

What this note does is to show an implementation, not in terms of the standard implementation of monads, but rather one based on Andrzej Filinski's paper "Representing Monads". That paper shows how a "monadic" program may be written in direct style--i.e. how to add "effects" to an Scheme/ML program without completely transforming that program into the normal monadic style. Shift and reset--delimited continuations-- are used to achieve this.

Reflection and monad transformers play an important role in this tour de force.


Posted to functional by Ehud Lamm on 5/11/03; 8:44:22 AM

Ehud Lamm - Re: Devils and Angels, via Monads  blueArrow
5/12/2003; 2:53:51 AM (reads: 464, responses: 0)
For a defition of devils and angels using call/cc see here.