page 1  (23 pages)
2to next section

A Dynamic Semantics for Haskell (Draft)

Kevin Hammond and Cordelia Hall?

April 14, 1992

Abstract

This paper defines a dynamic semantics for the functional programming language Haskell. The semantics defines the meaning of expressions, modules and programs, including all nonoptional I/O requests. All constructs in the Haskell language are considered. We use the same natural semantics style as the definition of Standard ML.

For brevity, we assume that the translations specified by the Wadler/Peyton Jones static semantics have been performed, and base our source language on the target language of the static semantics.

1 Introduction

This paper defines the dynamic semantics of the full Haskell language [HW90, HJW91, HJW92]. The dynamic semantics is complementary to the existing static semantics for Haskell [JW92] in two respects: firstly it defines the meaning of the second-order polymorphic lambda-calculus which is synthesised by that semantics; secondly it is defined using a natural semantic form, where meaning is expressed through judgement rules. This corresponds to the type inference judgements used in the static semantics.

The paper is designed as a short reference work, to be read in conjunction with the Haskell report. Consequently, only minimal explanatory text is provided here. We expect that other papers will provide a full commentary on the semantics, and take a more introductory slant.

We have not attempted to give an explicit semantics of graph-reduction. In the context of a language definition, such an approach seems both excessively low-level and unnecessarily restrictive. Rather, we have captured the essence of non-strict evaluation through the notion of closures": syntactic values paired with an environment.

This semantics thus defines the meaning of a Haskell program by specifying its resulting value (in terms of state-transitions on an initial state), but leaves unspecified such operational details

?Department of Computing Science, University of Glasgow, 17 Lilybank Gardens, Glasgow, UK. Tel: +44-41- 339-8855 ext f5619,4984g. Email: fkh,[email protected]