Computing Reviews
Today's Issue Hot Topics Search Browse Recommended My Account Log In
Review Help
Search
Programming in Haskell (2nd ed.)
Hutton G., Cambridge University Press, New York, NY, 2016. 318 pp. Type: Book (978-1-316626-22-1)
Date Reviewed: Aug 17 2017

Graham Hutton’s Programming in Haskell is a leading textbook on the functional programming language Haskell, which first appeared in 2007; it is instructive to see how its second edition reflects what has changed over the last decade. A particular strength of the first edition is its brevity (it comes in at some 150 pages), and the second edition doubles that length. Even taking into account a less compressed layout, this probably reflects some 50 percent more material, which comes in the form of more examples, more exercises, some sample solutions, and coverage of brand new topics.

The book is now structured into two parts: “Basic Concepts” and “Going Further.“ With a little rearrangement, the first part is made up of chapters from the first edition (augmented as noted previously) and covers the basics of functional programming in general (function definitions, recursion, types, and higher-order functions), as well as more Haskell-specific aspects: list comprehensions, type classes, and, of course, the Glasgow Haskell Compiler (GHC) system. The section is rounded off with a capstone example: a “Countdown” program that shows how Haskell is used to solve a particular concrete problem. Hutton writes very clearly throughout and illustrates his exposition with a well-chosen set of examples.

Knowledgeable readers may well have spotted that two of the most distinctive aspects of Haskell, monads and lazy evaluation, are not included in the introductory half of the book. Hutton is not alone in doing this: other authors of Haskell texts [1], myself included [2], have taken the same position in concentrating first on the essential aspects of functional programming, only looking at the particulars of how it works in Haskell after that.

While some parts of the second half (lazy evaluation and reasoning about functional programs) are treated much as before, the major changes from the first edition, both pedagogical and technical, come in this part. (There is an entirely new chapter on calculating compilers that gives readers a glimpse of Hutton’s research interests.)

The first edition hardly treated monads beyond introducing the type class and using the do notation in describing interactive programs, whereas the second edition foregrounds monads much more and presents parsers as an extended example of monads. A change like this would have been entirely foreseeable even at the point when the first edition was written, but other updates reflect much more recent changes in the Haskell ethos. Haskell has taken on a much more explicitly algebraic flavor, reflected by a range of new type classes that embody patterns of computation inspired by category theory.

Just as monads can be seen to embody the idea of “effectful” (potentially side-effecting) computation, “applicatives” capture the notion of applying a pure function to effectful arguments. Similarly, monoids are abstract structures in which elements can be combined by a binary operation with a unit (think multiplication and 1), and these can then be folded over collections of values, just as a set of numbers can be multiplied together. This new material is also very clearly and concisely presented, and it gives an approachable introduction to more abstract ideas.

Haskell is “growing old disgracefully”: it was first defined in 1990, and for 20 years or so was seen primarily as an academic, research-oriented language. The last decade has seen it grow in popularity as a practical language for program development from startups to financial multinationals. The language has also moved on and taken up the categorical/algebraic approach more fully, and it is good to see this reflected in Hutton’s new edition and “HaskellBook” [1]; other authors will need to do the same.

Hutton’s revisions of Programming in Haskell have taken the best aspects of the original (conciseness, clarity, and approachability) and built on this foundation to accommodate how Haskell has evolved. I recommend this book highly.

More reviews about this item: Amazon, Goodreads

Reviewer:  Simon Thompson Review #: CR145492 (1710-0640)
1) Allen, C.; Moronuki, J. Haskell programming from first principles. Gumroad, San Francisco, CA, 2015, http://haskellbook.com/.
2) Thompson, S. Haskell: the craft of functional programming (3rd ed.). Addison-Wesley, Harlow, UK, 2011.
Bookmark and Share
  Featured Reviewer  
 
Applicative (Functional) Programming (D.1.1 )
 
 
Haskell (D.3.2 ... )
 
Would you recommend this review?
yes
no
Other reviews under "Applicative (Functional) Programming": Date
Functional programming with Hope
Bailey R., Ellis Horwood, Upper Saddle River, NJ, 1990. Type: Book (9780133382372)
May 1 1992
Prospects for functional programming in software engineering
Banâtre J., Jones S., Le Métayer D. (ed), Springer-Verlag New York, Inc., New York, NY, 1991. Type: Book (9780387538525)
Aug 1 1992
An introduction to functional programming
Bird R. (ed), Wadler P., Prentice Hall International (UK) Ltd., Hertfordshire, UK, 1988. Type: Book (9780134841892)
May 1 1992
more...

E-Mail This Printer-Friendly
Send Your Comments
Contact Us
Reproduction in whole or in part without permission is prohibited.   Copyright 1999-2024 ThinkLoud®
Terms of Use
| Privacy Policy