Chapter 14Haskell Hands-On

by Paul Callaghan

The preceding chapter was a glimpse into the mindset of an experienced Haskell programmer. Now it’s time to do some programming. Let’s try a kata.

We’re going to use Dave Thomas’s word-chain kata,[7] and through it we’ll explore how functional programmers approach a problem, we’ll learn some Haskell syntax and libraries, and we’ll touch on performance and optimization of Haskell code.

The objective of the kata is to find a series of steps from one word to another, where in each step a single letter is changed such that the resulting string is also a valid word. For example, turning “lead” into “gold” with the path ["lead", "load", "goad", "gold"]. For simplicity, I’ll assume four-letter words ...

Get Functional Programming: A PragPub Anthology now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.