[Haskell-cafe] Parsec monad transformer with IO?

Gregory Collins greg at gregorycollins.net
Thu Mar 18 12:43:35 EDT 2010


Stefan Klinger <all-lists at stefan-klinger.de> writes:

> Hello!
>
> Nice, Parsec 3 comes with a monad transformer [1]. So I thought I could
> use IO as inner monad, and perform IO operations during parsing.
>
> But I failed. Monad transformers still bend my mind. My problem: I
> don't see a function to actually lift the IO operation into the
> ParsecT. It should be something like
>
>   lift :: IO a -> ParsecT s u IO a

ParsecT has a MonadIO instance:

    class Monad m => MonadIO m where
        liftIO :: IO a -> m a

G
-- 
Gregory Collins <greg at gregorycollins.net>


More information about the Haskell-Cafe mailing list