Re: [Haskell-cafe] Buttons and Clicks - State Monad

2009-01-31 Thread Henk-Jan van Tuyl
Note that, for wxHaskell, you should use Var instead of IORef, to be future proof. Regards, Henk-Jan van Tuyl -- http://functor.bamikanarie.com http://Van.Tuyl.eu/ -- On Sat, 31 Jan 2009 19:38:41 +0100, Cale Gibbard wrote: You might be misunderstanding the purpose of the State Int mo

Re: [Haskell-cafe] Buttons and Clicks - State Monad

2009-01-31 Thread Cale Gibbard
You might be misunderstanding the purpose of the State Int monad somewhat. A computation of type State Int a is internally represented by a function of type Int -> (Int, a). When you call runState, you effectively apply this pure function to an initial state, and get a final state and result. You

[Haskell-cafe] Buttons and Clicks - State Monad

2009-01-31 Thread guenni68
Hi, in this piece here http://moonpatio.com/fastcgi/hpaste.fcgi/view?id=1083#a1083 I'm trying to create a button that, every time when clicked, increases a counter by one and does a putStrLn of the counters current value. I'm trying to write this without any use of IORef but merely using the stat