[Haskell-cafe] Using Parsec with other monads

Roly Perera roly.perera at dynamicaspects.org
Fri Nov 28 18:27:22 EST 2008


Hi,

I've spent some time writing a parser using the Parsec library and was looking 
forward to being able to plug in some side-behaviour once I'd got the parser 
working.

Now it seems I can't actually do that in a nice way because Parsec appears to 
be "fixed" to a simple State monad.

I found this mentioned in the Cafe archives, but not much discussion.  Is there 
a reason Parsec wasn't implemented using the monad transformer approach?  Are 
there any plans to open it up?  It's a nice powerful library and a natural 
thing to want to do for example would be to plug in something like a Reader to 
track a variable context.  I guess one could abuse the State monad to achieve 
the goal but that feels like the wrong tool for the job.

Any insights appreciated.

thanks,
Roly





More information about the Haskell-Cafe mailing list