X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=blobdiff_plain;f=monad_transformers.mdwn;h=bf59f85a779e191338dd6fd992ffb34edac10b06;hp=8e459f0bc4f4b8bb57bb60271faa2cb5d5cd2e15;hb=c096178f6fdbedb2b6de4b198b05d77566588438;hpb=e32623b19bb5a3fd40ada29c912c7ecfc5784fab diff --git a/monad_transformers.mdwn b/monad_transformers.mdwn index 8e459f0b..bf59f85a 100644 --- a/monad_transformers.mdwn +++ b/monad_transformers.mdwn @@ -1,5 +1,5 @@ -So far, we've defined monads as single-layered things. Though in the Groenendijk, Stokhoff, and Veltmann homework, we had to figure out how to combine Reader, State, and Set monads in an ad-hoc way. In practice, one often wants to combine the abilities of several monads. Corresponding to each monad like Reader, there's a corresponding ReaderT **monad transformer**. That takes an existing monad M and wraps a Reader monad box around it. The way these are defined parallels the way the single-layer versions are defined. For example, here's the Reader monad: +So far, we've defined monads as single-layered things. Though in the Groenendijk, Stokhof, and Veltman homework, we had to figure out how to combine Reader, State, and Set monads in an ad-hoc way. In practice, one often wants to combine the abilities of several monads. Corresponding to each monad like Reader, there's a corresponding ReaderT **monad transformer**. That takes an existing monad M and wraps a Reader monad box around it. The way these are defined parallels the way the single-layer versions are defined. For example, here's the Reader monad: (* monadic operations for the Reader monad *)