Fudgets --

Purely Functional Processes
with applications to
Graphical User Interfaces

Magnus Carlsson
Thomas Hallgren

Department of Computing Science

Chalmers University of Technology and Gothenburg University

Avhandling för teknologie doktorsexamen i datalogi vid Chalmers Tekniska Högskola kommer, enligt beslut av sektionen för matematik och datavetenskap, att offentligt försvaras av Thomas Hallgren måndagen den 16 mars 1998, och Magnus Carlsson tisdagen den 17 mars 1998. Disputationerna äger rum kl 10.15 i Hörsalen, Plan 1, Matematisk Centrum, Eklandagatan 86, Göteborg.

Disputationen kommer att hållas på engelska.

The main result of this thesis is a method for writing programs with graphical user interfaces in purely functional languages. The method is based on a new abstraction called the fudget. The method makes good use of key abstraction powers of functional languages, such as higher order functions and parametric polymorphism.

The Fudget concept is defined in terms of the simpler concept of stream processors, which can be seen as a simple, but practically useful incarnation of the process concept. Programs based on fudgets and stream processors are networks of communicating processes that are built hierarchically, using combinators. Communication is type safe. The basic combinators provide serial compositions, parallel compositions, and loops. A key difference between previous work on stream processing functions and our approach is that we deliberately abstract away from the streams. We obtain a system that can be implemented deterministically, entirely within a purely functional language, but which also makes it possible to take advantage of parallel evaluation and indeterminism, where such is available within the functional language. The purely functional approach makes processes first class values and makes it easy to express process cloning and process migration.

The practical viability of the approach is demonstrated by the Fudget library, which is an implementation of a graphical user interface toolkit in the purely functional language Haskell, together with a number of small an large applications that have been implemented on top of the library.

In addition to GUI programming, fudgets are suitable for other forms of concurrent I/O programming. We demonstrate how client/server based applications can be we written, with type safe communication between client and server. We show a web browser as an example where GUI programming and network communication come together.

We view fudgets as one example of a more general combinator-based approach to promote the idea that a functional language together with combinator libraries is a good alternative to using less expressive languages propped by application-specific tools. We describe a set of combinators, reminiscent of parsing combinators, for building syntax-directed editors.