Re: [Haskell-cafe] adding state in GUIs (qtHaskell)

2009-09-15 Thread Alp Mestan
On Fri, Sep 11, 2009 at 5:55 PM, Jeremy O'Donoghue jeremy.odonog...@gmail.com wrote: snip I don't have anything as neat to show you as Duncan's suggetion (I'd also be interested to see a cleaner way to do it - this sort of code always grates a little with me, although all of the major

Re: [Haskell-cafe] adding state in GUIs (qtHaskell)

2009-09-11 Thread Roman Cheplyaka
* Duncan Coutts duncan.cou...@worc.ox.ac.uk [2009-09-10 20:43:54+] 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

Re: [Haskell-cafe] adding state in GUIs (qtHaskell)

2009-09-11 Thread Jeremy O'Donoghue
Michael Mossey wrote: Duncan Coutts wrote: On Wed, 2009-09-09 at 18:29 -0700, Michael P Mossey wrote: I'm trying to learn qtHaskell. I realize few people on this list know anything about qtHaskell, but I have a question that probably relates to all GUIs as implemented in Haskell. I just need

Re: [Haskell-cafe] adding state in GUIs (qtHaskell)

2009-09-10 Thread Dan Weston
One simple solution is to leave the state in Qt. As of Qt 4.2, in C++ you can use bool QObject::setProperty(const char * name, const QVariant value) QVariant QObject::property(const char * name) const to set and get properties on any QObject (hence any QWidget). Since I believe these are

Re: [Haskell-cafe] adding state in GUIs (qtHaskell)

2009-09-10 Thread Duncan Coutts
On Wed, 2009-09-09 at 18:29 -0700, Michael P Mossey wrote: I'm trying to learn qtHaskell. I realize few people on this list know anything about qtHaskell, but I have a question that probably relates to all GUIs as implemented in Haskell. I just need a hint that could help me figure out the

Re: [Haskell-cafe] adding state in GUIs (qtHaskell)

2009-09-10 Thread Michael Mossey
Dan Weston wrote: One simple solution is to leave the state in Qt. As of Qt 4.2, in C++ you can use bool QObject::setProperty(const char * name, const QVariant value) QVariant QObject::property(const char * name) const to set and get properties on any QObject (hence any QWidget).

Re: [Haskell-cafe] adding state in GUIs (qtHaskell)

2009-09-10 Thread Michael Mossey
Duncan Coutts wrote: On Wed, 2009-09-09 at 18:29 -0700, Michael P Mossey wrote: I'm trying to learn qtHaskell. I realize few people on this list know anything about qtHaskell, but I have a question that probably relates to all GUIs as implemented in Haskell. I just need a hint that could

[Haskell-cafe] adding state in GUIs (qtHaskell)

2009-09-09 Thread Michael P Mossey
I'm trying to learn qtHaskell. I realize few people on this list know anything about qtHaskell, but I have a question that probably relates to all GUIs as implemented in Haskell. I just need a hint that could help me figure out the next step, which I might be able to infer from the qtHaskell

Re: [Haskell-cafe] adding state in GUIs (qtHaskell)

2009-09-09 Thread Michael P Mossey
Been poking around. Maybe IORef has something to do with this? I found a qtHaskell example that seems to make use of IORef in order to accomplish something similar to what I want. Michael P Mossey wrote: I'm trying to learn qtHaskell. I realize few people on this list know anything about

Re: [Haskell-cafe] adding state in GUIs (qtHaskell)

2009-09-09 Thread Bulat Ziganshin
Hello Michael, Thursday, September 10, 2009, 5:29:33 AM, you wrote: I'm totally stuck on this part, because Haskell doesn't have state. There must Haskell support states (yes, IORef is equal to C++ reference type - it's a constant pointer to some memory area that you may read/write), but it