Hi Thomas and Tomasz,

A late comment about a MonadFix instance for Cont/ContT:

Thomas Jäger wrote:
> Hello Tomasz,
> 
> This stuff is very interesting! At first sight, your definition of
> getCC seems quite odd, but it can in fact be derived from its
> implementation in an untyped language.
> 
> On 7/7/05, Tomasz Zielonka <[EMAIL PROTECTED]> wrote:
> 

...

>>Besides sharing my happiness, I want to ask some questions:
>>
>>- is it possible to define a MonadFix instance for Cont / ContT?
> 
> It must be possible to define something that looks like a MonadFix
> instance, after all you can define generally recursive functions in
> languages like scheme and sml which "live in a ContT r IO monad", but
> this has all kinds of nasty consequences, iirc.
> 
> Levent Erkök's thesis suggests (pp. 66) that there's no implementation
> of mfix that satisfies the purity law.
> http://www.cse.ogi.edu/PacSoft/projects/rmb/erkok-thesis.pdf

A while ago, I attempted to marry value recursion a la Levent Erkök with
the continuation-monad transformer.  It seems possible if the underlying
monad has value recursion and references.  Interestingly, all mfix
properties except left shrinking appear to be valid.

There are slides about this (including implementation) at

  http://www.cse.ogi.edu/~magnus/mdo-callcc-slides.pdf

There is also a draft paper at

  http://www.cse.ogi.edu/~magnus/mdo-callcc.pdf

I should warn that the paper is still very unfinished.  If anyone is
interested in picking up the pieces together with me, please get in touch!

Cheers,
Magnus
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to