From: David P. <fee...@gm...> - 2007-08-03 17:15:08
|
On 8/3/07, Duncan Coutts <dun...@wo...> wrote: > > On Fri, 2007-08-03 at 09:49 -0700, David Pollak wrote: > > Howdy, > > > > I've started using Haskell and Gtk2Hs... it's pretty slick. I'm a > > Haskell newbie, but have a fair amount of experience with Scala. > > Anyway, I'm kind of confused about the following construct: > > window <- xmlGetWidget windowXml castToWindow "window" > > onDelete window deleteEvent > > onDestroy window destroyEvent > > > > > > The 'onDelete' and 'onDestroy' functions register events on the window > > that call the particular functions. I understand what is happening. > > I don't understand how. My understanding of Haskell is that there are > > no side effects for function calls, but it looks from that code like > > there are side effects galore. > > That's right. Almost all the Gtk+ functions are in the IO monad. See: > http://www.haskell.org/tutorial/io.html > > > It looks like some hidden state is being changed. Can someone help > > educate me as to what's going on? Is it that onDelete does in fact > > have the side effect of calling into Gtk and registered the event > > callback and thus there is a side effect here? > > Yes. > > > Also, while my intended deployment target is Windows, I will be doing > > a fair amount of my development on Mac OS X. It seems that the > > MacPorts versions of GTK and Glade and GTK2hs require X windows to > > run. Is that correct? Is there any Aqua version of GTK? > > Yes, the current Gtk+ default backend OS X is the X windows one. There > is a native OS X Gtk+ backend under development: > http://developer.imendio.com/projects/gtk-macosx > > Changed have been going into the main Gtk+ development repo, however it > has rather slow progress so don't hold your breath. > > Duncan Duncan, You are amazingly helpful and responsive. Thanks, David -- lift, the fast, powerful, easy web framework http://liftweb.net |