20090323

Using Glade and Gtk2Hs with Haskell on Debian Sid

I wanted to try this tutorial:

http://haskell.org/gtk2hs/docs/tutorial/glade/

For me, there were many difficulties. Actually, it seems that the problems were user error on my part, discovered after trying to repeat the process on a second computer. You need to install the dependencies:

apt-get install gtk2hs-doc libghc6-cairo-dev libghc6-gconf-dev libghc6-glade-dev libghc6-glib-dev libghc6-gnomevfs-dev libghc6-gstreamer-dev libghc6-gtk-dev libghc6-gtkglext-dev libghc6-soegtk-dev libghc6-sourceview-dev libghc6-svgcairo-dev

All of this works, except for:

E: Couldn't find package libghc6-sourceview-dev

Then I had to adjust my .hs file to match the contents of the XML file generated by Glade. For instance, I changed line 9 to read:

window <- xmlGetWidget xml castToWindow "HelloGTK2hs"

CORRECTION: This was my mistake. I typed "HelloGTK2hs" in the "name" field rather than the "window title" field. Be careful!

A note to myself: it might be wise to try a process a second time on another computer before writing a blog post!