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, 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 ...