[Haskell-cafe] ReadP and MonadFix
gracjanpolak at gmail.com
Sat Jun 24 06:30:48 EDT 2006
Thanks for your response!
I searched for something more found: An Abstract Monadic Semantics for
Value Recursion, Eugenio Moggi, Amr Sabry
Section 4 of this paper says something about References and
Continuations. But it will be quite hard to translate this into actual
code. Could you please point me to the running examples you were
I'm going to create MonadFix instance for the P monad and then I'll
see what can I achieve with that.
2006/6/23, Levent Erkok <erkokl at gmail.com>:
> 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.
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe