# Books

Books and tutorials covering many aspects of Haskell.

# Language Definition

- Simon Peyton Jones:
*Haskell 98 Language and Libraries*, Cambridge University Press, 2003, Hardback, 272 pages, ISBN: 0521826144, £35.00

**Book Description**

Haskell is the world's leading lazy functional programming language, widely used for teaching, research, and applications. The language continues to develop rapidly, but in 1998 the community decided to capture a stable snapshot of the language: Haskell 98. All Haskell compilers support Haskell 98, so practitioners and educators alike have a stable base for their work. This book constitutes the agreed definition of the Haskell 98, both the language itself and its supporting libraries. It has been considerably revised and refined since the original definition, and appears in print for the first time. It should be a standard reference work for anyone involved in research, teaching, or application of Haskell.The entire language definition is also available online: Language and library specification

# Textbooks

- Paul Hudak:
*The Haskell School of Expression: Learning Functional Programming through Multimedia*, Cambridge University Press, New York, 2000, 416 pp, 15 line diagrams, 75 exercises, Paperback $29.95, ISBN: 0521644089, Hardback $74.95, ISBN: 0521643384**Book Description**

This book teaches functional programming as a way of thinking and problem solving, using Haskell, the most popular purely functional language. Rather than using the conventional mathematical examples commonly found in other programming language textbooks, the author draws examples from multimedia applications, including graphics, animation, and computer music, thus rewarding the reader with working programs for inherently more interesting applications. Aimed at both beginning and advanced programmers, this tutorial begins with a gentle introduction to functional programming and moves rapidly on to more advanced topics. An underlying theme is the design and implementation of domain specific languages, using three examples: FAL (a Functional Animation Language), IRL (an Imperative Robot Language), and MDL (a Music Description Language). Details about programming in Haskell are presented in boxes throughout the text so they can be easily referred to and found quickly.The book's Web Site contains source files for all programs in the text, as well as the graphics libraries to run them under Windows and Linux platforms. It also contains PowerPoint slides useful for teaching a course using the textbook.

- Simon Thompson:
*Haskell: The Craft of Functional Programming*, Second Edition, Addison-Wesley, 507 pages, paperback, 1999. ISBN 0-201-34275-8.**Book Description**

The second edition of Haskell: The Craft of Functional Programming is essential reading for beginners to functional programming and newcomers to the Haskell programming language. The emphasis is on the process of crafting programs and the text contains many examples and running case studies, as well as advice an program design, testing, problem solving and how to avoid common pitfalls.Building on the strengths of the first edition, the book includes many new and improved features:

- Complete coverage of Haskell 98, the standard version of Haskell which will be stable and supported by implementations for years to come.
- An emphasis on software engineering principles, encouraging a disciplined approach to building reusable libraries of software components.
- Detailed coverage of the Hugs interpreter with an appendix covering other implementations.
- A running case study of pictures emphasizes the built-in functions which appear in the standard prelude and libraries. It is also used to give an early preview of some of the more complex language features, such as high-order functions.
- List comprehensions and the standard functions over lists are covered before recursion.
- Early coverage of polymorphism supporting the "toolkit" approach and encouraging the resuse of built-in functions and types.
- Extensive reference material containing details of further reading in books, journals and on the World Wide Web.
- Accompanying Web Site supporting the book, containing all the program code, further teaching materials and other useful resources.

**Synopsis**

This books introduces Haskell at a level appropriate for those with little or no prior experience of functional programming. The emphasis is on the process of crafting programs, solving problems, and avoiding common errors. - Richard Bird:
*Introduction to Functional Programming using Haskell*, 2nd edition, Prentice Hall Press, 1998, 460 pp., ISBN: 0-13-484346-0.From the cover:

After the success of the first edition, Introduction to Functional Programming using Haskell has been thoroughly updated and revised to provide a complete grounding in the principles and techniques of programming with functions.

The second edition uses the popular language Haskell to express functional programs. There are new chapters on program optimisation, abstract datatypes in a functional setting, and programming in a monadic style. There are completely new case studies, and many new exercises.

As in the first edition, there is an emphasis on the fundamental techniques for reasoning about functional programs, and for deriving them systematically from their specifications.

The book is self-contained, assuming no prior knowledge of programming, and is suitable as an introductory undergraduate text for first- or second-year students.

- Antony Davie:
*An Introduction to Functional Programming Systems Using Haskell*, Cambridge University Press, 1992. ISBN 0-521-25830-8 (hardback). ISBN 0-521-27724-8 (paperback).Cover:

Functional programming is a style of programming that has become increasingly popular during the past few years. Applicative programs have the advantage of being almost immediately expressible as functional descriptions; they can be proved correct and transformed through the referential transparency property.

This book presents the basic concepts of functional programming, using the language Haskell for examples. The author incorporates a discussion of lambda calculus and its relationship with Haskell, exploring the implications for parallelism. Contents: SASL for Beginners / Examples of SASL Programming / More Advanced Applicative Programming Techniques / Lambda Calculus / The Relationship Between Lambda Calculus and SASL / Program Transformation and Efficiency / Correctness, Equivalence and Program Verification / Landin's SECD Machine and Related Implementations / Further Implementation Techniques / Special Purpose Hardware / The Applicative Style of Semantics / Other Applicative Languages / Implications for Parallelism / Functional Programming in Von Neumann Languages

- Fethi Rabhi and Guy Lapalme:
*Algorithms: A functional programming approach*, Addison-Wesley, 235 pages, paperback, 1999. ISBN 0-201-59604-0

**Book Description**

The authors challenge more traditional methods of teaching algorithms by using a functional programming context, with Haskell as an implementation language. This leads to smaller, clearer and more elegant programs which enable the programmer to understand the algorithm more quickly and to use that understanding to explore alternative solutions.

**Key features:**- Most chapters are self-contained and can be taught independently from each other.
- All programs are in Haskell'98 and provided on a WWW site.
- End of chapter exercises throughout.
- Comprehensive index and bibliographical notes.

**Synopsis**

The book is organised as a classic algorithms book according to topics such as Abstract Data Types, sorting and searching. It uses a succession of practical programming examples to develop in the reader problem-solving skills which can be easily transferred to other language paradigms. It also introduces the idea of capturing algorithmic design strategies (e.g. Divide-and-Conquer, Dynamic Programming) through higher-order functions.

**Target audience**

The book is intended for computer science students taking algorithms and/or (basic or advanced) functional programming courses. - Jeremy Gibbons and Oege de Moor (eds.):
*The Fun of Programming*,Palgrave, 2002, 288 pages. ISBN 0333992857.**Book description:**

In this textbook, leading researchers give tutorial expositions on the current state of the art of functional programming. The text is suitable for an undergraduate course immediately following an introduction to functional programming, and also for self-study. All new concepts are illustrated by plentiful examples, as well as exercises. A website gives access to accompanying software. - Cordelia Hall and John O'Donnell:
*Discrete Mathematics Using a Computer*, Springer, 2000, 360 pages. ISBN 1-85233-089-9.**Book description:**

This book introduces the main topics of discrete mathematics with a strong emphasis on applications to computer science. It uses computer programs to implement and illustrate the mathematical ideas, helping the reader to gain a concrete understanding of the abstract mathematics. The programs are also useful for practical calculations, and they can serve as a foundation for larger software packages.Designed for first and second year undergraduate students, the book is also ideally suited to self-study. No prior knowledge of functional programming is required; the book and the online documentation provide everything you will need.

- Kees Doets and Jan van Eijck:
*The Haskell Road to Logic, Maths and Programming*. King's College Publications, London, 2004. ISBN 0-9543006-9-6 (14.00 pounds, $25.00).**Book description:**

The purpose of this book is to teach logic and mathematical reasoning in practice, and to connect logical reasoning with computer programming. Throughout the text, abstract concepts are linked to concrete representations in Haskell. Everything one has to know about programming in Haskell to understand the examples in the book is explained as we go along, but we do not cover every aspect of the language. Haskell is a marvelous demonstration tool for logic and maths because its functional character allows implementations to remain very close to the concepts that get implemented, while the laziness permits smooth handling of infinite data structures.We do not assume that our readers have previous experience with either programming or construction of formal proofs. We do assume previous acquaintance with mathematical notation, at the level of secondary school mathematics. Wherever necessary, we will recall relevant facts. Everything one needs to know about mathematical reasoning or programming is explained as we go along. We do assume that our readers are able to retrieve software from the Internet and install it, and that they know how to use an editor for constructing program texts.

After having worked through the material in the book, i.e., after having digested the text and having carried out a substantial number of the exercises, the reader will be able to write interesting programs, reason about their correctness, and document them in a clear fashion. The reader will also have learned how to set up mathematical proofs in a structured way, and how to read and digest mathematical proofs written by others.

The book can be used as a course textbook, but since it comes with solutions to all exercises (electronically available from the authors upon request) it is also well suited for private study. The source code of all programs discussed in the text, a list of errata, further relevant material and an email link to the authors can be found here.

- Simon Peyton Jones:
*Implementation of Functional Programming Language*,Prentice-Hall, 1987. ISBN 0134533259. - Simon Peyton Jones, David Lester:
*Implementing Functional Languages*, 1992.

The book is out of print. The full sources and a postscript version are available for free.

# Tutorials and books

## Introductions to Haskell

- A Gentle Introduction to Haskell
- By Paul Hudak, John Peterson, and Joseph H. Fasel. The title is a bit misleading. Some knowledge of another functional programming language is expected. The emphasis is on the type system and those features which are really new in Haskell (compared to other functional programming languages). A classic.

- Yet Another Haskell Tutorial
- By Hal Daume III et al. A recommended tutorial for Haskell that is still under construction but covers already much ground. Also a classic text.

- Beginning Haskell
- From IBM developerWorks. This tutorial targets programmers of imperative languages wanting to learn about functional programming in the language Haskell. If you have programmed in languages such as C, Pascal, Fortran, C++, Java, Cobol, Ada, Perl, TCL, REXX, JavaScript, Visual Basic, or many others, you have been using an imperative paradigm. This tutorial provides a gentle introduction to the paradigm of functional programming, with specific illustrations in the Haskell 98 language. (Free registration required.)

- Online Haskell Course
- By Ralf Hinze (in German).

- Functional Programming
- By Jeroen Fokker, 1995. (153 pages, 600 KB). Textbook for learning functional programming with Gofer (an older implementation of Haskell). Here without Chapters 6 and 7.

- Tutorial Papers in Functional Programming.
- A collection of links to other Haskell tutorials, from John Hughes.

- Two Dozen Short Lessons in Haskell
- By Rex Page. A draft of a textbook on functional programming, available by ftp. It calls for active participation from readers by omitting material at certain points and asking the reader to attempt to fill in the missing information based on knowledge they have already acquired. The missing information is then supplied on the reverse side of the page.

- The Little Haskeller
- By Cordelia Hall and John Hughes. 9. November 1993, 26 pages. An introduction using the Chalmers Haskell B interpreter (hbi). Beware that it relies very much on the user interface of hbi which is quite different for other Haskell systems, and the tutorials cover Haskell 1.2 , not Haskell 98.

- PLEAC-Haskell
- Following the Perl Cookbook (by Tom Christiansen and Nathan Torkington, published by O'Reilly) spirit, the PLEAC Project aims to gather fans of programming, in order to implement the solutions in other programming languages.

- Haskell-Tutorial
- By Damir Medak and Gerhard Navratil. The fundamentals of functional languages for beginners.

- A Guide to Haskell's Foreign Function Interface
- A guide to using the foreign function interface extension, using the rich set of functions in the Foreign libraries, design issues, and FFI preprocessors.

- Programming Haskell Wikibook
- A communal effort by several authors to produce the definitive Haskell textbook. Its very much a work in progress at the moment, and contributions are welcome.

- Video Lectures
- Lectures (in English) by Jürgen Giesl. About 30 hours in total, and great for learning Haskell. The lectures are 2005-SS-FP.V01 through 2005-SS-FP.V26. Videos 2005-SS-FP.U01 through 2005-SS-FP.U11 are exercise answer sessions, so you probably don't want those.

- Albert's Functional Programming Course
- A 15 lesson introduction to most aspects of Haskell.

- Introduction to Haskell
- By Chris Dutton, An "attempt to bring the ideas of functional programming to the masses here, and an experiment in finding ways to make it easy and interesting to follow".

- An Introduction to Haskell
- A brief introduction, by Brian Howard.

- Introduction to Haskell
- By Isaac Jones (2003).

## Reference material

- Tour of the Haskell Syntax
- By Arjan van IJzendoorn.

- Haskell Reference
- By Miloslav Nic.

- A Tour of the Haskell Prelude
- By Bernie Pope and Arjan van IJzendoorn.

- Useful Haskell functions
- An explanation for beginners of many Haskell functions that are predefined in the Haskell Prelude.

- Documentation for the standard libraries
- Complete documentation of the standard Haskell libraries.

- Haskell idioms
- A collection of articles describing some common Haskell idioms. Often quite advanced.

- Useful idioms
- A collection of short, useful Haskell idioms.

- Programming guidelines
- Some Haskell programming and style conventions.

## Motivation for Using Haskell

- Why Functional Programming Matters
- By John Hughes, The Computer Journal, Vol. 32, No. 2, 1989, pp. 98 - 107. Also in: David A. Turner (ed.): Research Topics in Functional Programming, Addison-Wesley, 1990, pp. 17 - 42.

Exposes the advantages of functional programming languages. Demonstrates how higher-order functions and lazy evaluation enable new forms of modularization of programs.

- Why Haskell matters
- Discussion of the advantages of using Haskell in particular. An excellent article.

- Higher-order + Polymorphic = Reusable
- By Simon Thompson. Unpublished, May 1997.

**Abstract:**This paper explores how certain ideas in object oriented languages have their correspondents in functional languages. In particular we look at the analogue of the iterators of the C++ standard template library. We also give an example of the use of constructor classes which feature in Haskell 1.3 and Gofer.

## Analysis and Design Methods

See Analysis and design.

## Teaching Haskell

- Where do I begin? A problem solving approach to teaching functional programming
- By Simon Thompson. In Krzysztof Apt, Pieter Hartel, and Paul Klint, editors, First International Conference on Declarative Programming Languages in Education. Springer-Verlag, September 1997.

**Abstract:**This paper introduces a problem solving method for teaching functional programming, based on Polya's `How To Solve It', an introductory investigation of mathematical method. We first present the language independent version, and then show in particular how it applies to the development of programs in Haskell. The method is illustrated by a sequence of examples and a larger case study.

- Functional programming through the curriculum
- By Simon Thompsonand Steve Hill. In Pieter H. Hartel and Rinus Plasmeijer, editors, Functional Programming Languages in Education, LNCS 1022, pages 85-102. Springer-Verlag, December 1995.

**Abstract:**This paper discusses our experience in using a functional language in topics across the computer science curriculum. After examining the arguments for taking a functional approach, we look in detail at four case studies from different areas: programming language semantics, machine architectures, graphics and formal languages.

- The Risks and Benefits of Teaching Purely Functional Programming in First Year
- By Manuel M. T. Chakravarty and Gabriele Keller. Journal of Functional Programming 14(1), pp 113-123, 2004. An earlier version of this paper was presented at Functional and Declarative Programming in Education (FDPE02).

**Abstract**We argue that teaching purely functional programming as such in freshman courses is detrimental to both the curriculum as well as to promoting the paradigm. Instead, we need to focus on the more general aims of teaching elementary techniques of programming and essential concepts of computing. We support this viewpoint with experience gained during several semesters of teaching large first-year classes (up to 600 students) in Haskell. These classes consisted of computer science students as well as students from other disciplines. We have systematically gathered student feedback by conducting surveys after each semester. This article contributes an approach to the use of modern functional languages in first year courses and, based on this, advocates the use of functional languages in this setting.

## Using Monads

- Tackling the awkward squad: monadic input/output, concurrency, exceptions, and foreign-language calls in Haskell
- Simon Peyton Jones. Presented at the 2000 Marktoberdorf Summer School. In "Engineering theories of software construction", ed Tony Hoare, Manfred Broy, Ralf Steinbruggen, IOS Press, ISBN 1 58603 1724, 2001, pp47-96. The standard reference for monadic IO in GHC/Haskell.
**Abstract:**Functional programming may be beautiful, but to write real applications we must grapple with awkward real-world issues: input/output, robustness, concurrency, and interfacing to programs written in other languages.

- The Haskell Programmer's Guide to the IO Monad - Don't Panic.
- Stefan Klinger. This report scratches the surface of category theory, an abstract branch of algebra, just deep enough to find the monad structure. It seems well written.

- All About Monads
- By Jeff Newbern. This tutorial aims to explain the concept of a monad and its application to functional programming in a way that is easy to understand and useful to beginning and intermediate Haskell programmers. Familiarity with the Haskell language is assumed, but no prior experience with monads is required.

- What the hell are Monads?
- By Noel Winstanley. A basic introduction to monads, monadic programming and IO. This introduction is presented by means of examples rather than theory, and assumes a little knowledge of Haskell.

- Monads for the Working Haskell Programmer -- a short tutorial
- By Theodore Norvell.

See also Research papers/Monads and arrows

## Using Arrows

- Arrows: A General Interface to Computation
- Ross Paterson's page on arrows.

See also Research papers/Monads and arrows

## Attribute Grammars

Wouter Swierstra's WhyAttributeGrammarsMatter.

Utrecht University's Attribute Grammar System tools include also an attribute grammar compiler, UUAGC. The concept of attribute grammar was used in their Essential Haskell Compiler project, which gives us not only a working programming language, but also a good didactical material about using attribute grammars, e.g. in writing compilers.

Albeits these materials are self-contained, they reveal that the theory of attribute grammars is related to these concepts:

- circular programming
- catamorphism

Here is a HaWiki page on CircularProgramming.

## Categorical Programming

Catamorphisms and related concepts, categorical approach to functional programming, categorical programming. Many materials cited here refer to category theory, so as an introduction to this discipline see the *Foundations* section at the end of this page.

- Erik Meijer, Maarten Fokkinga, Ross Paterson: Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire. See also related documents (in the CiteSeer page). Understanding the article does not require a category theory knowledge -- a self-contained material on the concept of catamorphism, anamoprhism and other related concepts.
- Varmo Vene and Tarmo Uustalu: Functional Programming with Apomorphisms / Corecursion
- Varmo Vene: Categorical Programming with Inductive and Coinductive Types. The book accompanies the deep categorical theory topic with Haskell examples.
- Tatsuya Hagino: A Categorical Programming Language
- Charity, a categorical programming language implementation.
- Deeply uncurried products, as categorists might like them article mentions a conjecture: relatedness to Combinatory logic

## Data Structures

- Purely Functional Data Structures
- Chris Okasaki, 232 pp., Cambridge University Press, 1998. ISBN 0-521-63124-6

From the cover:Most books on data structures assume an imperative language like C or C++. However, data structures for these languages do not always translate well to functional languages such as Standard ML, Haskell, or Scheme. This book describes data structures and data structure design techniques from the point of view of functional languages. It includes code for a wide assortment both of classical data structures and of data structures developed exclusively for functional languages.This handy reference for professional programmers working with functional languages can also be used as a tutorial or for self-study. Haskell source code for the book

See Research papers/Data structures

## Schools on Advanced Funtional Programming

*Advanced Functional Programming*, First International Spring
School on Advanced Functional Programming Techniques, Bastad, Sweden, LNCS 925, Springer-Verlag, 1995 (editors: J. Jeuring, E. Meijer).

*Functional Parsers*by Jeroen Fokker, p. 1-23.*Monads for functional programming*by Philip Wadler, p. 24-52.*The Design of a Pretty-printing Library*by John Hughes, p. 52-96.*Functional Programming with Overloading and Higher-Order Polymorphism*, Mark P. Jones, p. 97-136.*Programming with Fudgets*by Thomas Hallgren and Magnus Carlsson, p. 137-182.*Constructing Medium Sized Efficient Functional Programs in Clean*by Marko C.J.D. van Eekelen and Rinus J. Plasmeijer, p. 183-227.*Merging Monads and Folds for Functional Programming*by Erik Meijer and Johan Jeuring, p. 228-266.*Programming with Algebras*by Richard B. Kieburtz and Jeffrey Lewis, p. 267-307.*Graph Algorithms with a Functional Flavour*by John Launchbury, p. 308-331.

*Advanced Functional Programming*, Second International Summer School on Advanced Functional Programming Techniques, Evergreen State College, WA, USA, LNCS 1126, Springer-Verlag, 1996 (editors: J. Launchbury, E. Meijer, T. Sheard).

*Composing the User Interface with Haggis*by Sigbjorn Finne and Simon Peyton Jones, p. 1-37.*Haskore Music Tutorial*by Paul Hudak, p. 38-67.*Polytypic Programming*by Johan Jeuring and Patrick Jansson, p. 68-114.*Implementing Threads in Standard ML*by Peter Lee, p. 115-130.*Functional Data Structures*by Chris Okasaki, p. 131-158.*Heap Profiling for Space Efficiency*by Colin Runciman and Niklas Röjemo, p. 159-183.*Deterministic, Error-Correcting Combinator Parsers*by S. Doaitse Swierstra and Luc Duponcheel, p. 184-207.*Essentials of Standard ML Modules*by Mads Tofte, p. 208-238.

Advanced Functional Programming, Third International School, AFP'98,
in Braga, Portugal from 12th to 19th September 1998, LNCS 1608, Springer-Verlag, 1999
(editors: D. Swierstra, P. Henriques and J. Oliveira).

All lecture notes and further material are available from the web site.

# Foundations

- Practical Foundations of Mathematics
- Paul Taylor. Cambridge University Press, ISBN: 0-521-63107-6, xii+576 pages, September 2000.

- Toposes, Triples and Theories
- Michael Barr and Charles Wells. The revised version of their formerly Springer Verlag published book is online for free download. Note that they use the name
*triple*instead of*monad*.

# Research papers

A large collection of research papers published on various aspects of Haskell.