2010/12/29 michael rice <nowg...@yahoo.com>
>
> 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
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to