A functional programming course in 6 books
My recommendations for a robust foundation in the paradigm
I will be hosting a workshop at the Clojure/conj on Wednesday, November 12 in Charlotte, North Carolina. My workshop is about domain modeling in Clojure. You can get 25% off the workshop using code DOMAINJ25OFFCONJ. And you can get 25% off tickets to the talks at the conference using code CLJ18BIRTHDAY. I’d love to see you there!
Here’s a series of books that give an introduction to the majesty and variety of functional programming.
Pure and higher-order functions
Grokking Simplicity, my own book, provides the necessary groundwork for functional programming. It begins way before most books begin by encouraging the distinction between pure and impure functions. Once that’s mastered, higher-order functions are explored. It has gotten high praise. I don’t feel weird hyping my own book because I wrote it because no book was taking up the task. However, be careful with chapter 3. Every time I open it, I dream of rewriting it for a second edition.
Separating data and behavior
Data-Oriented Programming by Yehonathan Sharvit, introduces the idea of programming with data and not objects. Since most people will be familiar with the standard object-oriented methodology of combining data with behavior, this book presents a very different perspective: Maybe data can be treated separately from behavior.
It is a decidedly Clojure-centered view of functional programming, but even a die-hard Haskeller will find some similarity to how they program, albeit using types instead of run-time schema checks. I think the idea of writing functions over data is such a foreign idea that it’s important to show how the other side lives. However, if there’s one thing from data-oriented programming that I wish was treated more in the book, it’s that much of the time, we don’t need to model our data quite so much. In other words, we’re not always building entities and defining their schemas. Sometimes, the best part of data-oriented programming is just leaving the data as it is and making a program that is data in, data out.
Functional domain modeling
So, I am writing a book on this right now, but it’s not done and what’s been published online will certainly change. It’s meant to be a hands-on guide to the intermediate skills of the programmer. Once you know how to write functions and for loops, where do you turn to write good functions and for loops? If you’re interested, go read the 200 pages that are already online for free. But I’m rewriting all of it to be more focused on learnability and objective. The premise is that software design does not need so much hand waving.
While you wait, you can read Domain-Modeling Made Functional by Scott Wlaschin. It’s good if a little hand-waving, like most software design books. I daresay that it’s the best book I’ve read explaining Domain-Driven Design.
Functional algorithms
Thinking Functionally with Haskell is one I enjoy. If you want something rigorous from someone who takes functional programming seriously, this is a great book. It reads a little like a textbook. But at the same time, it doesn’t have the 3-page code listings some industry books have. The algorithms are chosen to gradually show you the range of techniques you’ll need to solve any problem using functional, as opposed to imperative, style.
Types and category theory
I’ve read several books on these two areas, but I can’t say I’ve found a book that really captures the magic enough for me to recommend it. However, I haven’t read every book. Functional Programming in Scala, by Paul Chiusano and Runar Bjarnason, is extremely popular. It’s so popular, it’s referred to by its color (the red book). Still, I doubt it’s giving me what I’m looking for. I want a book that expresses the beauty and elegance of types and Haskell-style category theory beyond “preventing errors” and reinventing imperative programming.
Linguistic abstraction
This topic isn’t learned quite enough today. We tend to talk about simple indirections like runtime dispatch to solve problems. Runtime dispatch, however, is just a fancy conditional. Sometimes your indirection needs a totally new semantics. My two favorite books for these are Principles of Artificial Intelligence Programming (PAIP) by Peter Norvig and Software Design for Flexibility by Chris Hanson and Gerald Jay Sussman.
PAIP is a classic from the time when AI meant “good programming”. The examples are in Common Lisp and it shows how to build a logic programming system (similar to Prolog), rules engines, and equation simplifiers in a data-driven style.
Software Design for Flexibility is written using Scheme and shows other techniques for developing powerful abstractions for conquering complex problems. The premise is that your semantics need to have more degrees of freedom than they problem you’re solving. Both books show techniques we rarely reach for, even when conditionals and recursion don’t cut it. If I had to pick one, it would be PAIP.
Conclusion
If someone read these books and tried to apply them, they’d be well on their way to mastering functional programming. I know there are a lot of books I’m not familiar with, so please don’t take this as an exhaustive list. It’s just a list of good books that fill niches in the FP journey. I’d love to hear your takes on required reading. Just hit reply and send me a message. Please share what you like about your recommendations along with the titles.


For category theory I can recommend 'Category Theory for Programmers' by Bartosz Milewski
https://bartoszmilewski.com/2014/10/28/category-theory-for-programmers-the-preface/