The ins and outs of Clean I/O
- 1 January 1995
- journal article
- research article
- Published by Cambridge University Press (CUP) in Journal of Functional Programming
- Vol. 5 (1) , 81-110
- https://doi.org/10.1017/s0956796800001258
Abstract
Functional programming languages have banned assignment because of its undesirable properties. The reward of this rigorous decision is that functional programming languages are side-effect free. There is another side to the coin: because assignment plays a crucial role in Input/Output (I/O), functional languages have a hard time dealing with I/O. Functional programming languages have therefore often been stigmatised as inferior to imperative programming languages because they cannot deal with I/O very well. In this paper, we show that I/O can be incorporated in a functional programming language without loss of any of the generally accepted advantages of functional programming languages. This discussion is supported by an extensive account of the I/O system offered by the lazy, purely functional programming language Clean. Two aspects that are paramount in its I/O system make the approach novel with respect to other approaches. These aspects are the technique of explicit multiple environment passing, and the Event I/O framework to program Graphical User I/O in a highly structured and high-level way. Clean file I/O is as powerful and flexible as it is in common imperative languages (one can read, write, and seek directly in a file). Clean Event I/O provides programmers with a high-level framework to specify complex Graphical User I/O. It has been used to write applications such as a window-based text editor, an object based drawing program, a relational database, and a spreadsheet program. These graphical interactive programs are completely machine independent, but still obey the look-and-feel of the concrete window environment being used. The specifications are completely functional and make extensive use of uniqueness typing, higher-order functions, and algebraic data types. Efficient implementations are present on the Macintosh, Sun (X Windows under Open Look) and PC (OS/2).Keywords
This publication has 15 references indexed in Scilit:
- Conventional and uniqueness typing in graph rewrite systemsPublished by Springer Nature ,1993
- Report on the programming language HaskellACM SIGPLAN Notices, 1992
- Proving memory management invariants for a language based on linear logicPublished by Association for Computing Machinery (ACM) ,1992
- Generating efficient code for lazy functional languagesPublished by Springer Nature ,1991
- Concurrent cleanPublished by Springer Nature ,1991
- Functions and dynamic user interfacesPublished by Association for Computing Machinery (ACM) ,1989
- Clean — A language for functional graph rewritingPublished by Springer Nature ,1987
- Term graph rewritingPublished by Springer Nature ,1987
- Linear logicTheoretical Computer Science, 1987
- Can programming be liberated from the von Neumann style?Communications of the ACM, 1978