Re: [Haskell-cafe] Re: Doing without IORef

2008-04-05 Thread Jinwoo Lee
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

Re: [Haskell-cafe] Re: Doing without IORef

2008-04-05 Thread Bryan O'Sullivan
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

Re: [Haskell-cafe] Re: Doing without IORef

2008-04-04 Thread Jinwoo Lee
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

Re: [Haskell-cafe] Re: Doing without IORef

2008-04-04 Thread Bryan O'Sullivan
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

Re: [Haskell-cafe] Re: Doing without IORef

2008-04-03 Thread Jinwoo Lee
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

Re: [Haskell-cafe] Re: Doing without IORef

2008-04-03 Thread ajb
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