[Haskell-cafe] ReadP and MonadFix

Levent Erkok erkokl at gmail.com
Fri Jun 23 17:11:20 EDT 2006


Gracjan:

To declare "ReadP" an instance of MonadFix; you'll first have to make the P
monad into a MonadFix instance. That can be done using existing techniques
in the literature.

ReadP is essentially the continuation monad transformer wrapped around P.
It's well known in the value-recursion literature that continuation monad is
too "strong" to have a value-recursion operator. I am not aware of any
"simple" solutions in that space. Hence, ReadP is beyond the realm of
current theories of value recursion.

Having said that, I'd also like to point out that Amr Sabry and Eugenio
Moggi, and independently  Magnus Carlsson has done some interesting work to
extend value recursion to the world of continuations; which might help with
your particular problem. Essentially, you end up adding some extra
infrastructure to your monad, and then forgo some of the basic axioms of
value recursion. But you can get running examples!

Maybe all you'll need is a MonadFix instance of P; which is definitely
doable with the current techniques. Anything further would actually make a
nice research paper...

-Levent. (I could provide references to above work if needed; all is
available on the net freely, anyhow.)

On 6/23/06, Gracjan Polak <gracjanpolak at gmail.com> wrote:
>
> Hi all,
>
> A question for hot summer day: Text.ParserCombinators.ReadP.ReadP is
> an instance of Monad. Could it be an instance of MonadFix too?
>
> I'm not that sharp in Haskell to write it myself, but it seems I could
> make use of such a beast. :) Anybody willing to share?
>
> This will also present the advantage of Lazy over Eager Parser
> Combinators, mentioned in some other thread.
>
> --
> Gracjan
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org//pipermail/haskell-cafe/attachments/20060623/2450c1cf/attachment-0001.htm


More information about the Haskell-Cafe mailing list