[Haskell-cafe] Re: Doing without IORef

Jinwoo Lee jinwoo68 at gmail.com
Sat Apr 5 09:23:08 EDT 2008

Thanks Bryan,
To summarize, embed IORef inside ReaderT and use that IORef to read/change
the file path info, both in IO monad and MyState monad. Is this right?

Thank you all!


On Sat, Apr 5, 2008 at 1:56 AM, Bryan O'Sullivan <bos at serpentine.com> wrote:

> Jinwoo Lee wrote:
> > I haven't used ReaderT. What are the advantages when using ReaderT
> > instead of StateT in this case?
> A StateT lets you replace one IORef with another, since it gives you
> mutable state.  A ReaderT gives you *immutable* state, so the type
> system guarantees that you'll always be using the same IORef.
>        <b

Jinwoo Lee
Always remember that you are unique. Just like everyone else.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20080405/fde546d5/attachment.htm

More information about the Haskell-Cafe mailing list