[Haskell-cafe] Using Parsec with other monads

Derek Elkins derek.a.elkins at gmail.com
Fri Nov 28 18:36:01 EST 2008


On Fri, 2008-11-28 at 23:27 +0000, Roly Perera wrote:
> 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.

Parsec3 is implemented as a monad transformer.



More information about the Haskell-Cafe mailing list