[Haskell-beginners] database question

Brandon S Allbery KF8NH allbery at ece.cmu.edu
Sun Sep 19 19:53:54 EDT 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 9/18/10 16:30 , Gaius Hammond wrote:
> Oh, but I am already in the IO monad there aren't I.... And doQuery *isn't*
> but I have declared that it *should be* (e.g. an instance of typeclass
> MonadIO). Is that accurate?

You're in ReaderT at that point.  If you "lift" a monadic expression from
there, it will be run in WriterT.

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 :)

- -- 
brandon s. allbery     [linux,solaris,freebsd,perl]      allbery at kf8nh.com
system administrator  [openafs,heimdal,too many hats]  allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university      KF8NH
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkyWopIACgkQIn7hlCsL25VRAwCfSLR1M++NqB1wPFbI8LQoD1Lk
GS4Anitq5B3KDectcCF18HGDb5XqRxIo
=tBJU
-----END PGP SIGNATURE-----


More information about the Beginners mailing list