> [EMAIL PROTECTED] (Marcin 'Qrczak' Kowalczyk)
> I'm curious how the generic translation into mfix could look like if
> everything is visible everywhere ...
The implementation of recursive definitions when the right-hand sides
have computational effects is ancient (dates back to at least Landin's
SECD machine). It is currently available in Scheme. The idea is the
usual: bind the recursive variables to bogus initial values, evaluate
the right hand sides, and update.
It is well-known that the update used to realize the recursion
interacts with the evaluation of the right-hand sides. An obvious
problem is when the right-hand side captures a continuation; a related
problem is when the right-hand side is polymorphic. Several solutions
are possible:
1. Scheme: do nothing; let the programmer deal with it.
2. Levent and John's proposal: disallow recursion within the continuation
monad (and now apparently disallow polymorphism).
3. Sabry and Friedman (http://www.cs.uoregon.edu/~sabry/papers/mfix.ps):
use a monad to express recursion and let the programmer define the
desired interaction using monad transformers.
--Amr