Hi, Michael.

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.  
;-)

Thanks for the link. I go there a lot.

Michael

--- On Wed, 12/29/10, Michael Lazarev <[email protected]> wrote:

From: Michael Lazarev <[email protected]>
Subject: Re: [Haskell-cafe] Reader monad
To: "michael rice" <[email protected]>
Cc: [email protected]
Date: Wednesday, December 29, 2010, 12:42 PM



2010/12/29 michael rice <[email protected]>
>
> From the docs (and tuts) newtype creates a new type out of an existing type
> and gives a single constructor for doing so.

>
> what is the existing type?


Michael, you may want to see this section:
http://learnyouahaskell.com/functors-applicative-functors-and-monoids#the-newtype-keyword

and also section titled "type vs. newtype vs. data" below. It has good 
explanation why there is
at least three keywords in Haskell to define types, and which of them do what. 
And how they do it.

>From my experience, this book in a whole could be useful to you. It also has 
>explanation how Reader

is constructed step-by-step.

As far as I know, there has been code for Reader monad in Haskell Wiki. 
Unfortunately,
after it has been migrated, "page not found" error has become not very uncommon 
on it, and

either i was not able to found it, or it really is missing.

Out of practical considerations, library authors decided to define more 
complicated ReaderT monad transformer, 
because it can be made to behave as Reader if the former wraps Identity monad.


Hope this helps.





      
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to