Re: [Haskell-cafe] Doing without IORef

2008-04-03 Thread Jinwoo Lee
OK. I understand it now. I think the article Claude suggested is worth a read because it shows how to hide using IORef in simple APIs. Thanks, jinwoo On Fri, Apr 4, 2008 at 10:17 AM, Brandon S. Allbery KF8NH < [EMAIL PROTECTED]> wrote: > > On Apr 3, 2008, at 21:07 , Jinwoo Lee wrote: > > > But

Re: [Haskell-cafe] Doing without IORef

2008-04-03 Thread Brandon S. Allbery KF8NH
On Apr 3, 2008, at 21:07 , Jinwoo Lee wrote: But I still have to use IORef this way. You can't escape the IORef unless you can convince the library to thread your state everywhere that it needs to be modified *and* where it needs to be read, without copying it. -- brandon s. allbery [sol

Re: [Haskell-cafe] Doing without IORef

2008-04-03 Thread Jinwoo Lee
But I still have to use IORef this way. On Thu, Apr 3, 2008 at 7:08 PM, Alfonso Acosta <[EMAIL PROTECTED]> wrote: > > type MyState a = StateT FilePath IO a > > > > > Is there any way in which I can do without IORef in tabHandler and > > commandLoop (written in red and bold, if you can see)? > >

Re: [Haskell-cafe] Doing without IORef

2008-04-03 Thread Brandon S. Allbery KF8NH
On Apr 3, 2008, at 6:03 , Jinwoo Lee wrote: Recently I wrote a code that uses readline library (System.Console.Readline). I had to maintain a state (file path) and do IO throughout the code, so I decided to use StateT monad. The problem was that in order to retrieve the current state (file

Re: [Haskell-cafe] Doing without IORef

2008-04-03 Thread Claude Heiland-Allen
Jinwoo Lee wrote: Hi, Recently I wrote a code that uses readline library (System.Console.Readline). I had to maintain a state (file path) and do IO throughout the code, so I decided to use StateT monad. The problem was that in order to retrieve the current state (file path) inside the handl

Re: [Haskell-cafe] Doing without IORef

2008-04-03 Thread Alfonso Acosta
> type MyState a = StateT FilePath IO a > Is there any way in which I can do without IORef in tabHandler and > commandLoop (written in red and bold, if you can see)? How about keeping the IORef but storing it inside the state? type MySate a = StateT (IORef FilePath) IO a __

[Haskell-cafe] Doing without IORef

2008-04-03 Thread Jinwoo Lee
Hi, Recently I wrote a code that uses readline library (System.Console.Readline). I had to maintain a state (file path) and do IO throughout the code, so I decided to use StateT monad. The problem was that in order to retrieve the current state (file path) inside the handler that had been registe