Recursion in Haskell
The first serious step towards the mastery of Haskell is a deep understanding of recursion. It permeates the language.
Learning Haskell just gained a new chapter introducing recursion in significant detail. Although recursion is widely used in most languages, and an experienced developer might regard it as a topic that they already mastered, functional languages take it to a new level. In particular, we introduce a number of recursive patterns and explain how concrete function implementations may be derived by following these patterns. This leads to a systematic treatment that, over the years, we found to be the most effective way of explaining recursion. We combined this with screencasts where we demonstrate the use of Haskell playgrounds to interactively derive recursive functions. This chapter is mostly concerned with list processing. Given the ubiquity of recursion in Haskell, this is a topic that we will return to more than once in forthcoming chapters of Learning Haskell.