[Haskell-cafe] Reader monad

michael rice nowgate at yahoo.com
Wed Dec 29 21:16:30 CET 2010


Hi, Daniel.

I had an "Aha!" moment and it all makes sense now. Just as the State monad can hold a generator (which can change) and pass it down a calculation chain, a Reader monad can hold an environment (which doesn't change) and pass it down a calculation chain. I was wondering how I could include a (global) house betting limit in that craps application I've been playing with (without passing it as a parameter) and it sounds like the Reader monad would be an ideal candidate. Correct? It also sounds like a job for monad transforms.

Michael

--- On Wed, 12/29/10, Daniel Fischer <daniel.is.fischer at googlemail.com> wrote:

From: Daniel Fischer <daniel.is.fischer at googlemail.com>
Subject: Re: [Haskell-cafe] Reader monad
To: haskell-cafe at haskell.org
Cc: "michael rice" <nowgate at yahoo.com>
Date: Wednesday, December 29, 2010, 2:47 PM

On Wednesday 29 December 2010 19:30:11, michael rice wrote:
> Yes, I'd already noticed that ReaderT preceded Reader. Guess I'll have
> to check out the Indentity monad too. I hope it's not dependent upon yet
> another monad. 

No, the Identity monad stands alone.
And as the name suggests, it's pretty simple.




      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20101229/bfa5a06b/attachment.htm>


More information about the Haskell-Cafe mailing list