LISP and Symbolic Computation, 8(4)293-341

State in Haskell

John Launchbury, Oregon Graduate Institute, PO Box 91000, Portland, OR 97291-1000
Simon L. Peyton Jones, University of Glasgow, G12 8QQ, Scotland

Abstract: Some algorithms make critical internal use of updatable state, even though their external specification is purely functional. Based on earlier work on monads, we present a way of securely encapsulating stateful computations that manipulate multiple, named, mutable objects, in the context of a non-strict, purely-functional language. The security of the encapsulation is assured by the type system, using parametricity. The same framework is also used to handle input/output operations (state changes on the external world) and calls to C.

Keywords: functional programming, side-effects, types, input-output

[local copy]
[picture of journal cover]

May 2003 - hosc@brics.dk