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!
jinwoo
On Sat, Apr 5, 2008 at 1:56 AM, Bryan O'Sullivan [EMAIL PROTECTED] wrote:
Jinwoo Lee wrote:
I haven't used
Jinwoo Lee wrote:
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?
Yep. In case you ever want to multithread your program, you might want
to use an MVar instead of an IORef.
b
Hi Andrew,
I haven't used ReaderT. What are the advantages when using ReaderT instead
of StateT in this case?
Thanks,
jinwoo
On Fri, Apr 4, 2008 at 2:07 PM, [EMAIL PROTECTED] wrote:
G'day all.
Quoting Jinwoo Lee [EMAIL PROTECTED]:
Thanks everyone!
Now I think using IORef is the most
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
Thanks everyone!
Now I think using IORef is the most practical way to do this.
And Claude, I will look into the article that you mentioned.
jinwoo
On Fri, Apr 4, 2008 at 3:08 AM, Peter Hercek [EMAIL PROTECTED] wrote:
Jinwoo Lee wrote:
Is there any way in which I can do without IORef in
G'day all.
Quoting Jinwoo Lee [EMAIL PROTECTED]:
Thanks everyone!
Now I think using IORef is the most practical way to do this.
Just a suggestion: Store it in a ReaderT instead of a StateT.
Cheers,
Andrew Bromage
___
Haskell-Cafe mailing list