[Haskell-cafe] adding state in GUIs (qtHaskell)
roma at ro-che.info
Fri Sep 11 03:56:28 EDT 2009
* Duncan Coutts <duncan.coutts at worc.ox.ac.uk> [2009-09-10 20:43:54+0000]
> A personal favourite of mine is having the GUI event handler post data
> over a channel to a thread. That thread reads from the channel and deals
> with the events. The state of the GUI app is then held as local
> parameters in that thread.
> Doing this of course requires that the GUI lib you're using can cope
> with normal Haskell (forkIO) threads. This is possible with gtk2hs, I
> don't know about the others.
I also would be happy to see some code. Recently I need to write a small
app in gtk2hs which had to deal with state. I used Reader monad with
IORef's in it, but got tired of mixing code in different monads. (It
would help, btw, if gtk2hs functions were not in IO, but in MonadIO).
So I'm curious how 'gtk2hs app done right' looks like.
Roman I. Cheplyaka :: http://ro-che.info/
"Don't let school get in the way of your education." - Mark Twain
More information about the Haskell-Cafe