Abstract In a recent paper, Peyton Jones et al. proposed a design for imprecise exceptions in the lazy functional programming language Haskell [PJRH+99]. The main contribution of the design was that it allowed the language to continue to enjoy its current rich algebra of transformations. However, the denotational semantics used to formalise the design does not combine easily with other extensions, most notably that of concurrency. We present an alternative semantics for a lazy functional language with imprecise exceptions which is entirely operational in nature, and combines well with other extensions, such as I/O and concurrency. The semantics is based upon a convergence relation, which describes evaluation, and an exceptional convergence relation, which describes the raising of exceptions. Convergence and exceptional convergence lead naturally to a simple notion of refinement, where a term M is refined by N whenever they have identical convergent behaviour, and any exception raised by N can also be raised by M. We are able to validate many call-by-name equivalences and standard program transformations, including the ubiquitous strictness transformation. The first author gratefully acknowledges the hospitality of the Microsoft Research Lab (Cambridge), where this work was begun, and the Oregon Graduate Institute, where this work was completed. The second author was supported by grant number GR/L38356 from the U.K. EPSRC.
[1]
Simon L. Peyton Jones,et al.
Concurrent Haskell
,
1996,
POPL '96.
[2]
Simon L. Peyton Jones,et al.
Imperative functional programming
,
1993,
POPL '93.
[3]
Gordon D. Plotkin,et al.
Call-by-Name, Call-by-Value and the lambda-Calculus
,
1975,
Theor. Comput. Sci..
[4]
Andrew Moran,et al.
Making choices lazily
,
1995,
FPCA '95.
[5]
Andrew Moran,et al.
Improvement in a lazy context: an operational theory for call-by-need
,
1999,
POPL '99.
[6]
Glynn Winskel,et al.
Relational Reasoning about Functions and Nondeterminism
,
1999
.
[7]
Simon L. Peyton Jones,et al.
A semantics for imprecise exceptions
,
1999,
PLDI '99.
[8]
Uday S. Reddy,et al.
Imperative functional programming
,
1996,
CSUR.
[9]
Andrew Moran,et al.
Erratic Fudgets: a semantic theory for an embedded coordination language
,
1999,
Sci. Comput. Program..
[10]
Patrick Cousot,et al.
Inductive definitions, semantics and abstract interpretations
,
1992,
POPL '92.
[11]
Douglas J. Howe.
Proving Congruence of Bisimulation in Functional Programming Languages
,
1996,
Inf. Comput..
[12]
Andrew Moran,et al.
Call-by-name, Call-by-need, and McCarthy's Amb
,
1998
.