Functional Programming Strategies

Read the current draft online: PDF

About the Book

Functional Programming Strategies is the book for people who want to master functional programming. I've been using functional programming techniques for about 25 years, and I've realized that what is important is how I think about code. This book teaches the concepts and processes I use to create code—what I call programming strategies. For example, “following the types” is the strategy of using type information the guide the implementation. Multiple case studies show how the strategies apply to real world code.

The book's examples use Scala. Scala has significant commercial adoption, and its expressivity allows me to easily demonstrate all the strategies. However, the concepts in the book are not limited to Scala and translate to other modern typed languages, such as Rust, Kotlin, OCaml, or Typescript.

What You'll Learn

Data and Codata

Learn to represent concepts in code as data or codata, how to choose between the two based on extensibility requirements, and how to translate from one to the other.

Practical Examples

Real-world code examples covering core programming concerns such as error handling and complete systems such as a stream-processing engine.

Type Classes

Learn how type classes provide a novel form of extensibility. Understand core type classes such as moniods, applicative functors, and monads, and how to use them as code level abstractions and as conceptual tools for program design.

Dualities

See how dualities—bidirectional program transformations—can be used as an organizing principle and as a tool for program design. Explore the dualities between data and codata, direct-style and continuation-passing style, and more in practical case studies.

Interpreters

Learn how interpreters can be used to handle effects in a functional style, and see the major implementation strategies and approaches to optimization. Solve the “expression problem” with extremely flexible tagless final style interpreters.

A Whole Lot More

This just scratches the surface of what's in the book. At over 500 pages it's a comprehensive reference for all the major concepts and techniques used by experts.

Stay Updated

The book will be launched in 2026. Get notified when it launches and receive exclusive updates. We'll never share your email address with anyone else.

Powered by Buttondown.