REVIEW - Haskell - The Craft of Functional Programming


Title:

Haskell

The Craft of Functional Programming

Author:

Simon Thompson

ISBN:

Publisher:

Addison-Wesley (1999)

Pages:

487pp

Reviewer:

Francis Glassborow

Reviewed:

April 2003

Rating:

★★☆☆☆


Many of us old hands learnt our programming by experience. The younger generations have, in theory, the good fortune to have been taught programming. Those that have gone to universities and colleges with high quality Computer Science Departments will have been taught a wide range of programming with several different programming languages. Unfortunately many will have attended courses where lecturers have little grasp of the way that languages differ and teach all programming languages as if they were just variations on a theme. This no more works for programming languages than it does for natural ones.

Functional programming languages are very popular with Computer Science Departments that have developed as an offshoot from Mathematics Departments. However they are often completely ignored by other Computer Science Departments. I am sure that this is, at least in part, brought about by a fundamental lack of understanding as to what these languages are. Some of you may be thinking that languages such as C and C++ must be functional languages because they rely heavily on calling functions. When you hear someone talk about procedural languages you jump to the conclusion that those must be languages like Pascal that have procedures. This is the typical kind of confusion that arises out of the way computing creates its own jargon.

A pure function 'returns a value' and has NO side effects. A pure procedure does NOT return a value and is entirely side effects. By convention a functional programming language is one where, in as far as is possible, the mechanism is on of using pure functions. Please note that there is no place for assignment in a functional style of programming because storing information is a side effect and so is procedural. Indeed it is one of the curiosities of C and C++ that assignments return values as well as store them. Unfortunately, C++ assignments do not return values but references and so are definitely on the procedural end of the scale unlike C where assignments return a value, that places C closer to the functional end. Perhaps it would be interesting to design a pure procedural language.

Now I am assuming that the reader of this review is a reasonably competent programmer in a language such as C, C++, C#, Java etc. but has not studied a functional language nor functional programming. If you are not in this category this review is not for you.

Haskell is a powerful functional language that has had a good deal of work done on it. Indeed even the basic language supports ideas of genericity and there are versions available that provide powerful extensions to support template-like coding. Those wanting to learn Haskell will find that there are good quality compilers available as freeware so the only up front cost is buying a suitable book and finding the time to study it with an open mind.

But why should a C++ programmer invest valuable time studying a functional language? The answer is that while C++ is not a functional language, and it isn't even a language with specific support for functional programming, it is a language in which functional ideas can thrive. The combination of function objects and templates provides a powerful programming environment, but one that few programmers are prepared for. I believe that exposure to functional programming will help the C++ programmer acquire insights that will help them use those C++ tools more effectively.

This book is an excellent text on functional programming in general and Haskell in particular. Studying (there is no point in just skimming through it quickly, you will miss the deep structure that will broaden your skills) this book will enrich your understanding of programming and add to your ability to program effectively.

One advantage of being a niche language is that the bookshelves are not weighed down with poorly written texts. This book does not have many competitors so rating it as one of the top ten books on Haskell isn't saying anything. However this book would rate well even if it had many competitors. Its author has a solid grasp of functional programming (FP) and this book explains both the basics and the specific mechanics of FP in Haskell. If you are a serious programmer looking to broaden your skills and craftsmanship try to find the time to study this book, you will be rewarded for doing so.


Book cover image courtesy of Open Library.





Your Privacy

By clicking "Accept Non-Essential Cookies" you agree ACCU can store non-essential cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

Current Setting: Non-Essential Cookies REJECTED


By clicking "Include Third Party Content" you agree ACCU can forward your IP address to third-party sites (such as YouTube) to enhance the information presented on this site, and that third-party sites may store cookies on your device.

Current Setting: Third Party Content EXCLUDED



Settings can be changed at any time from the Cookie Policy page.