[Haskell-beginners] database question

Brent Yorgey byorgey at seas.upenn.edu
Sun Sep 19 22:34:28 EDT 2010


On Sun, Sep 19, 2010 at 07:53:54PM -0400, Brandon S Allbery KF8NH wrote:
> Since IO must always be at the base(*) of any stack of monad transformers it
> is used in, the MonadIO class provides a convenience function liftIO that
> lifts its argument directly to the IO monad without having to step through
> any intermediates.
> 
> _______
> * we call it "lifting" but we also claim IO is at the base of the stack, and
> I at least usually expect a base to be at the bottom.  Nice and
> confusing :)

I think of liftIO as lifting its argument *from* the IO monad (at the
bottom of the stack) into a monad higher up the stack.

  liftIO :: (MonadIO m) => IO a -> m a

So I don't find it confusing/backwards at all.

-Brent


More information about the Beginners mailing list