A GTK+ Binding for Haskell

GTK+ (The GIMP Toolkit) is an open source GUI toolkit originally developed for the GIMP (GNU Image Manipulation Program). However, it is used in a range of other projects by now, most notably the GNOME (GNU Network Object Model Environment) and the Mozilla project (Netscape's open source browser). GTK+ is portable as it does not rely on X window's Xt library, but instead accesses the underlying window system via a thin API, called GDK. Furthermore, it uses a consequent object-oriented design and realizes callback functionality via a flexible and powerful signal mechanism (not identical with, but oriented by *nix signals). GTK+ object-oriented features are realized in plain C; and it has been designed with an eye on making it not too difficult to interface from high-level languages. Therefore, it is a very interesting choice for a GUI toolkit for Haskell.

The lattest news:

Currently, the GTK+ binding is available for the Glasgow Haskell Compiler only. If you want to have it for another Haskell system, try to get Glasgow's New Foreign Function Interface (FFI) implemented in that system. I think, the FFI is a good design and Haskell bitterly needs a protable, widely supported foreign function call mechanism.

Current Status

The GTK+ Binding for Haskell is currently in an alpha release state. In other words, the basic functionality (including GTK+'s object system and the signal mechanism) is implemented and basic widgets (like windows and and buttons) are available. However, more sophisticated widgets are missing and the code is only lightly tested. The following widgets (plus some basic widgets) are implemented: horizontal and vertical boxes, plain buttons, check buttons, toggle buttons, radio buttons, range widgets (scales and scollbars), text entries, labels, file selectors, separators, and windows.

The implemented functionality should already be sufficient for simple dialogs. You may want to have a look at the screenshot and code of one of the small examples that I used to test the binding.

Releases

gtk+hs-0.3.2.tar.gz
Works with GTK+ 1.2 and has experimental support for GtkGLArea. To use it, you need GHC 4.02; if you are using Linux, you can install the RPM for GHC 4.02.
gtk+hs-0.3.1.tar.gz
Works with GTK+ 1.2. To use it, you need GHC 4.02; if you are using Linux, you can install the RPM for GHC 4.02.
gtk+hs-0.3.0.tar.gz
This is the last alpha release based on GTK+ 1.0; furthermore, some bugs fixed and the system is restructured to reflect the decomposition into GLib, GDK, and GTK+. To use it, you need GHC 4.02; if you are using Linux, you can install the RPM for GHC 4.02.
gtk+hs-0.2.1.tar.gz
Second alpha release (includes class hierarchy, signals, and basic widgets). To use it, you need GHC 4.01 with Sven Panne's callback patch; if you are using Linux, you can install the RPM for GHC 4.01 including the patch. (The forthcoming GHC 4.02 should also be ok.)
gtk+hs-0.1.0.tar.gz
First alpha release (includes class hierarchy, signals, and basic widgets). Requirements are like for the above.

The files are also available per ftp.

Future Development

The groundwork is laid; next, I plan to add some of the more complex widgets (probably, the text widget, scrolled windows, and some basic GDK functionality). The code is released under the GNU Library General Public Lisence. This basically means that you can do whatever you want with it, as long as you share any improvements to the library with the rest of us. I welcome everybody to contribute bindings for widgets and functions that are not supported yet; I only ask any contributors that they code in accordance with the style and design of the existing modules. I will soon add a simple design specification, which outlines the basic structure of the binding.


This page is part of Manuel Chakravarty's WWW-stuff.

Last modified: Fri Apr 23 00:15:40 JST 1999