The Pilgrimage
Welcome to a sweeping survey of Haskell Heaven: a travelogue through the vantage points that make Functional Programming beautiful.
Welcome to a sweeping survey of Haskell Heaven! Here I am, trying to document a journey to — and around — this hallowed land, via personal “snaps” and essays about beautiful vistas in the vast landscape of Functional Heaven that Haskell opens up.
Like any travelogue, the hope is that this rambling set of essays stokes an interest in fellow wanderers, to get a first-hand glimpse of a way of thinking about computation that is, genuinely, beautiful.
Figure: The five vantage points this book climbs, in order. Each builds on the last — Category Theory at the summit is the view you get once functions, types, immutability, laziness, and purity are all beneath you.
Why “Heaven”?
Most programming languages ask you to compromise: give up mathematical rigor for speed, give up safety for expressiveness, give up reasoning about correctness for the convenience of mutable state. Haskell is the rare language that refuses most of those trades. It stays close enough to the underlying mathematics — Lambda Calculus, Category Theory — that a great deal of what you write is not just code, but a claim you can prove.
That closeness to the math is the “Zen” this book keeps returning to. A Haskell function isn’t a metaphor for a mathematical function — it is one, in a much stronger sense than in most other languages. An equation you write down is true forever, the same way is true forever. Once you start seeing code this way, a lot of what looks like Haskell’s strangeness turns out to be honesty.
Laziness is a game-changer… it is why Haskell is worth learning, even if you never use it for “real” work.
Salient features of the landscape
- Functions that mirror their mathematical counterparts, with no default side effects — and, importantly, functions that need not be about numbers at all (Chapter 3 spends real time on this, because it’s the first mistake almost every beginner makes). Underneath all of it sits Lambda Calculus (Chapter 2), the three-rule system that turns out to be exactly as powerful as any computer ever built.
- Inspiration from Category Theory, which aims to subsume all of Set Theory as a foundation for mathematics — a foundation Haskell borrows concepts from directly: Functors, Applicatives, Monads, Monoids, Arrows. Most of Haskell’s staple concepts have a sound mathematical grounding, unlike languages that traded rigor away for other priorities.
- Lazy evaluation, which allows working with infinite data structures and gives strong support for modularity — you can describe all the positive integers, or all the primes, as ordinary values, and only ever pay for the part you actually look at.
- Purity. Side effects are explicitly modeled in the type system, so pure and impure code stay visibly, checkably separate — which is what lets you reason about a Haskell program rather than just running it and hoping.
- A very expressive type system with powerful type inference, so you rarely write the types you’re relying on, but the compiler always knows them.
- “Beautiful Concurrency,” to borrow a phrase from Simon Peyton Jones (Chapter 8) — purity turns out to make concurrent programming dramatically safer, almost as a side benefit, by letting a whole transaction be safely thrown away and retried.
- A small gallery of Pearls (Chapter 12) — short, famous programs like a swap-free Quicksort and a self-referential infinite list of Fibonacci numbers — that show everything above working together at once.
Functional Programming’s roots go back to Alonzo Church’s Lambda Calculus in the 1930s — decades before the first electronic computer. Haskell is, in a very literal sense, a modern implementation of a 90-year-old idea about what computation is, not just how to make a machine do it.
How to read this book
Each chapter that follows is one vantage point: it stands alone, but the view gets better the higher you climb. If Haskell’s everyday syntax — pattern matching, guards, currying, sections — isn’t yet second nature, Base Camp (Chapter 1) is a fast, practical tour built specifically to close that gap before the climb gets conceptual; skip it entirely if it isn’t news to you. From there we start with Lambda Calculus — the tiny system of three rules everything else in this book is secretly built from — then the single most misunderstood idea in this whole landscape, what a function actually is, before working up through types, immutability, laziness, purity, concurrency, and finally the Category Theory concepts (Functors, Applicatives, Monads) that tie the whole trip together. A closing gallery of Pearls shows several of these ideas working together at once, in short, famous programs.
There’s no rush. Every chapter that follows pairs an idea with real, runnable Haskell — sit with the code, not just the prose.