[Haskell-cafe] [Haskell Cafe] Troubles with StateT and Parsec

Luke Palmer lrpalmer at gmail.com
Mon Aug 3 15:55:09 EDT 2009

On Mon, Aug 3, 2009 at 11:46 AM, Paul Sujkov<psujkov at gmail.com> wrote:
> 2) too many lifts in the code. I have only one function that really affects
> state, but code is filled with lifts from StateT to underlying Parser

You do know you can do this, right?

do x <- get
   put (x + 1)
   lift $ do

If you only have one use of the state, you should be able to write the
rest of the parser as a regular Parsec without the StateT (including
type signatures), and lift it all at once.


More information about the Haskell-Cafe mailing list