This is in part a response to Paul Hudak's call for standard Haskell
libraries, and in part a request for information.  It seems that
everyone at Glasgow that does Haskell graphics hacking has their own
set of (usually monadic) functions, which they will `release at some
point'.  It would nice to know what options are already available, or
are likely to be shortly available.  So I'm trying to compile a list
of options an application writer has if they want graphics in their
Haskell program, in particular interacting with the X window system.

My personal interests in having such a list of options are two-fold;

 [1] The CM Haskell project are developing a sizable application that
     really requires a graphical front end. Any option chosen for this
     should be workable across the Haskell spectrum (GHC, HBC, Yale,
     NHC, Gofer).

 [2] At some point this summer I'm planning on adding a graphical interface
     onto my chess game processing program, Cherry. For this I'm not so
     bothered if it uses extensions to Haskell that are GHC specific, but
     it would be nice to use a portable solution.

Could anyone that has *any* information about a Haskell graphical
library please mail me a short summary of any such library they know
about. This includes systems that I've mentioned, but have missed out
some important point and/or benefit of the system.

So far I've been able to glean the following information from talking
to people here at Glasgow:

        --- Duncan Sinclair's Swish program. ----
   ref. ``Graphical User Interfaces for Haskell'',
        Duncan C. Sinclair,
        FP Glasgow Workshop, 1993

   Requires: tcl and tk online.

Duncans idea is to write the actual graphical interface in tk/tcl and
let this interface interact with the Haskell program. He has a working
demo of a 3D-maze program running under hbc, and a port to 1.3 IO is
underway.  Swish is actually an augmented version of wish, the tk
`shell'.  Though the system is not suitable for fast, pixel level
interaction (as in the game of life), tk *is* impressive, and this
system does give the application writer complete access all of tk's

        ----- Satnam's OpenLook interface ----

   Requires: OpenLook Intrinsics Toolkit and Glasgow Haskell

This is a set of modules written in Glasgow Haskell (and now ported to
have a 1.3 IO interface) that provide extensive access to the OpenLook
Widget set. Satnam has a Mac-Draw like program written using this
interface which looks very good.

                        -- Fudgets --

   ref. `FUDGETS: A Graphical User Interface in a Lazy Functional Language'
   Magnus Carlsson and Thomas Hallgren

   Requires: hbc

This a graphics toolkit, and it is currently only supported by
hbc (and lml). As a system is looks powerful, and the authors
have some nice looking demos. It currently depend on an augmented
Request/Response mechanism, and I dont know if it could be re-built
on top of any monadic IO XLib library.

                        ---- XLib(s) ----

There are a number of XLib libraries floating around.

        o Yale have one based on the Common Lisp X Interface
        o Sigbjorn Finne has one
        o I have bits one one

They all share the idea of a one-to-one mapping from Xlib calls into
Haskell monadic functions.  However there are different levels of
access provided by these libraries.  For example, in my library I
assume only one GC and display, and provide:

        pointPoint :: Int -> Int -> IO ()

While Yale provide:

        pointPoint :: XDrawable -> XGcontext -> XPoint -> IO ()

both share the same concepts, even though clearly the Yale function
offers more to the user.

                --- Other Work at Glasgow ---

There is been some work done by Sigbjorn Finne and Simon Peyton Jones
on building a toolkit on top of Sigbjorn's XLib library. Quote:

 "The goal of the work Simon PJ and I(sof) are doing is
to provide a framework for programming highly interactive
graphical user interfaces that make use of the Good Features
of FP/Haskell, i.e., composition, non-strictness, monadic
abstractions etc., together with the support for
concurrency. We are currently developing a system where
it is possible to compose interactive components/widgets
to create larger ones (larger in terms of behaviour and/or
appearance). These composed widgets enjoy the same status
as provided ones, something that is not the case in current
mainstream toolkits.

The ghc support for (Haskell) threads plus its state interface
play important roles, together with a library of picture combinators
for describing 2D graphics. The interface to X is at the Xlib level,
relying heavily on ghc's _ccall_/_casm_s.

Although not generally usable at the moment, we hope
to have something ready for other GHC users to try out in the first
half of'95."

                        -- o O o --

So, whos got a graphics library for their Haskell compiler, and whats
the current implementation and/or availability status?


Andy Gill                               CM Haskell Project
[EMAIL PROTECTED]                      Department of Computing Science          University of Glasgow, UK

Reply via email to