Haskell
The Craft of Functional Programming
Simon Thompson
Overview
Named in honour of Haskell Curry, whose work has had a profound
influence on functional programming, the Haskell language is growing
rapidly in popularity - especially as a vehicle to teach introductory
programming concepts. This book introduces Haskell at a level
appropriate for those with little or no prior experience of functional
programming. The emphasis throughout is on crafting programs, solving
problems and avoiding common pitfalls.
In three parts the book
- first builds a foundation, focusing on programming basic types and lists,
using first-order, non-polymorphic programs
- then looks at the three ideas of higher-order functions, polymorphism and
type classes, which together give modern functional programming its
distinctive flavour and power
- finally discusses larger-scale programming, supported by an exploration of
user-defined types, modules, lazy evaluation and IO programming using monads.
Amongst its features are
- an analysis of program behaviour and efficiency
- a strong emphasis on software engineering and problem-solving
techniques
- an optional thread on proving that programs have the properties required of
them which runs through the text
- software modification and re-use are emphasised in the discussion of
design issues
- design advice is supplemented with examples and case studies of
varying size and complexity
- appendices contain support material of various kinds - pointers to sites
from which implementations of Haskell and Gofer can be obtained;
common error messages; a glossary of programming terms; functions
from parts of the Haskell standard preludes; and more
- over 400 exercises of varying difficulty
Haskell systems
- the text is designed to be used with any Haskell implementation, such as
Hugs (Haskell Users Gofer System) whose interface and error messages are
described in some detail.
Note that the Hugs system described is Hugs 1.01; the June 1996
Yale release of the
system is similar, but implements the full Haskell module system rather than projects as stated in the text; full details of the small number of differences are
given in the code files.
- the material takes account of the latest revision to the language definition,
Haskell 1.3
- the text can also be used with the Gofer system.
Code for the functions defined in the text is available from the WWW site
given below; code for Haskell and Gofer systems is provided.
Contents
Basic Functional Programming:
Introducing functional
programming. Basic types and simple programs. Reasoning about
programs. Data structures: Lists. Reasoning about lists.
Abstraction:
Generalization. Functions as values. Classes in Haskell. Checking types.
Larger-Scale Programming:
Algebraic types. Case Study:
Huffman codes. Abstract data types. Lazy programming. Input/Output
and interaction. Program behaviour.
Appendices:
A: Functional and
imperative programming. B: Further reading. C: Glossary. D:
Understanding programs. E: Haskell operators. F: Implementations of
Haskell. G: Gofer and Hugs errors. H: Some useful functions.
Bibliography.
© Simon Thompson, 1996.
Last modified 16 July 1996.