The Beauty and the Beast Peter Achten, Rinus Plasmeijer December 1992 University of Nijmegen, The Netherlands peter88@cs.kun.nl, rinus@cs.kun.nl Abstract This paper presents a method for programming window-based I/O in a pure functional language. This method enables the programmer to specify interactions at a very high level of abstraction. It employs a machine independent declarative specification of devices such as windows, dialogues and menus. These devices are specified via predefined algebraic data types containing event handlers (user defined higher- order functions). All low level event handling is hidden from the programmer. The event stream is handled by a library function that takes the algebraic specification of the devices and applies recursively the appropriate event handler for each event. The system is implemented for the lazy functional language Concurrent Clean. It has been used successfully for the implementation of large interactive applications such as a window based editor and a relational database. Due to the use of uniqueness types (that make it possible to define func- tions that perform updates without violating the functional semantics) applications run as efficient as their imperative counterparts: they can be actually used in practice. We feel that the presented method turns I/O handling into one of the strengths of functional languages.