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

Bryan O'Sullivan bos at serpentine.com
Mon Aug 3 15:50:09 EDT 2009


On Mon, Aug 3, 2009 at 10:46 AM, Paul Sujkov <psujkov at gmail.com> wrote:


> parseSyslog :: StateT Integer Parser TimeStamp
> parseString :: StateT Integer Parser LogString
>
> and the following code:
> parseString = do [...]
>

Without real code to look at, it's impossible to properly debug the errors
in your pseudocode above. For instance, your type signatures aren't real,
and you don't mention which version of Parsec you're using.

Regardless, you shouldn't need to use monad transformers with Parsec, as it
has its own support for managing state that gives you exactly the same
features as StateT. See the getState, setState, and updateState functions. I
notice that you try to explain why you are using StateT later in your
message, but I don't understand your description.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090803/f656ef83/attachment.html


More information about the Haskell-Cafe mailing list