A pilgrimage, on the web

Haskell
Heaven

A sweeping survey of Functional Programming — the Zen of the math underneath it, the beauty of code that never lies about what it does, and the vantage points Category Theory opens up once you climb high enough.

Map of the five vantage points

The Trail

Thirty stops across six stages. Follow the path, or jump ahead — it’s your pilgrimage.

I · Base Camp Learning to read Haskell
  1. 00 Overview The Pilgrimage Welcome to a sweeping survey of Haskell Heaven: a travelogue through the vantage points that make Functional Programming beautiful.
  2. 01 Foundations Base Camp: A Whirlwind Tour of the Haskell Landscape Type signatures, pattern matching, guards, currying, sections, lambdas, recursion — the practical vocabulary every later chapter assumes you already have. If any of this is new, start here. If none of it is, skip ahead with a clear conscience.
  3. 02 Lambda Calculus Lambda Calculus: The Engine Underneath Before there was Haskell, before there were computers at all, Alonzo Church wrote down a system with three rules that turned out to be able to compute anything computable. Every function you will ever write in Haskell is that system, wearing nicer syntax.
  4. 03 Foundations What IS a Function? The single most common beginner mistake: assuming functions are about numbers. They're about mappings — from anything, to anything.
  5. 04 Foundations Types: Sets in Disguise Types aren't red-tape the compiler makes you deal with — they're the domains and codomains from Chapter 3, made explicit and checked for you.
II · The Functional Landscape Why Haskell feels different
  1. 05 Immutability Immutability: Equations, Not Instructions In Haskell, x = 5 isn't an instruction to store 5 in a box called x — it's a mathematical equation, true for the rest of the program's life.
  2. 06 Laziness Laziness and Infinite Data Haskell can define AllPositiveIntegers as an honest, infinite list — and find primes among them — because nothing gets computed until you actually ask to see it.
  3. 07 Purity Purity and Side Effects A pure function's entire relationship with the world is its inputs and its return value — everything else lives in IO, a type that turns 'having an effect' into 'being a value.'
  4. 08 Concurrency Beautiful Concurrency Simon Peyton Jones called it Beautiful Concurrency for a reason: once effects are values (Chapter 7), a transaction can simply be thrown away and retried if it conflicts — turning one of programming's hardest problems into a small, composable idea.
III · The Abstraction Ridge Structure appears
  1. 09 Category Theory Functors: Mapping Over Context The first proper Category Theory concept in Haskell: a Functor is anything you can map a function 'inside' — a list, a Maybe, a tree, a future computation — without changing its shape.
  2. 10 Category Theory Applicatives: Functions in Context Functor lets you map a plain function over a context. Applicative lets the function itself be wrapped in that same context — which is exactly what you need to combine several independent effectful values.
  3. 11 Category Theory Monads: Sequencing with Context The concept with the scariest reputation in all of Haskell, and the simplest honest description: a Monad lets one context-carrying step decide what happens next, based on what the previous step actually produced.
  4. 20 Category Theory Monoids and Semigroups: Combining Things The pilgrimage's epilogue promised more peaks — Monoids among them. This closes that loop: the single algebraic pattern behind addition, list concatenation, and string-joining, precise enough that GHC can check it, and general enough that it quietly powers half the standard library's folding functions.
  5. 24 Category Theory Foldable and Traversable: Two More Members of the Family Functor, Applicative, and Monad each earned a full chapter. Foldable and Traversable are the two typeclasses quietly completing that family — one generalizing sum, length, and toList to any structure at all, the other generalizing what it means to run an effectful function over every element and get the effects back in the right shape.
IV · Abstractions at Work Turning ideas into programs
  1. 12 Pearls Pearls: Beauty in Small Programs A gallery of short, famous Haskell programs — Quicksort and Mergesort with no swaps or mutation at all, primes tested against the literal textbook definition, a self-building Huffman coding tree, dynamic programming that fills in its own table, and an infinite list of Fibonacci numbers defined in terms of itself — each one a small, complete demonstration of everything this book has covered.
  2. 13 Category Theory Optics: Seeing Into Structure Nested immutable records are painful to update by hand — Haskell's answer, lenses, turns out to be built from nothing but the Functor you already know, in a derivation short enough to fit on one page.
  3. 21 Category Theory QuickCheck: Property-Based Testing This book has claimed the Functor and Monad laws matter since Chapter 9, without ever actually checking them. QuickCheck is how — and it's also the tool that started an entire testing movement other languages later copied wholesale.
  4. 22 Category Theory Parser Combinators: Applicative, Earning Its Keep One of Haskell's most satisfying 'oh, THAT'S what Applicative is for' moments: a tiny parsing library, built entirely from Functor, Applicative, and Alternative, with no new machinery invented along the way — the direct ancestor of Megaparsec and Parsec.
  5. 23 Category Theory Embedded Domain-Specific Languages Parser Combinators and Optics were already embedded domain-specific languages, without ever being named as such. This chapter names the pattern properly, explains exactly why Haskell is unusually suited to it, and surveys the real, production libraries — Diagrams, Servant, Shake, Esqueleto — that lean on the same idea.
  6. 25 Category Theory Reader, Writer, State: Monads You Build By Hand Effects Beyond IO leaned on mtl's MonadReader and MonadState without ever showing what Reader or State actually are. This chapter builds all three — Reader, Writer, and State — from nothing but function wrapping, the same from-scratch derivation Parser Combinators gave to parsing.
V · Higher Peaks Types, effects, and deeper machinery
  1. 14 Category Theory Type Families and the Kind Tower Base Camp's newtype trick — Age and UserId can't be mixed up — turns out to be the beginning of a much bigger idea: types that compute other types, checked entirely at compile time, with zero runtime cost.
  2. 15 Purity Effects Beyond IO A quick, necessary detour into RankN types — quietly already at work in runST and Lens — followed by the real subject: what happens once a program needs more than one effect at a time, and the three generations of tools Haskell has built to keep that tractable.
  3. 17 Foundations A Field Guide to GHC Extensions A practical reference for the GHC language extensions this book has used along the way, plus the common ones it hasn't needed yet — grouped by what problem each one actually solves, with a note on when reaching for it is worth it.
  4. 18 Category Theory Two Derivatives: Zippers and Automatic Differentiation A zipper turns 'walk to a position, remember it, and come back efficiently' into a data structure — and its shape is, astonishingly, the literal calculus derivative of the type it navigates. Automatic differentiation takes that same word seriously in the other direction: computing exact derivatives of real functions by structural program transformation, which is precisely what powers backpropagation in every neural network trained today.
  5. 26 Lambda Calculus Back to the Calculus: Encodings, Recursion, and Why Laziness Works Chapter 2 kept the lambda calculus practical — just enough to explain currying and point-free style. Now that laziness, purity, and Functors have all had their turn, it's worth returning to that same tiny system and seeing the rest of what it can do: encode its own data, recurse with no names at all, and explain, with an actual theorem, why Haskell chose to be lazy in the first place.
  6. 27 Immutability Equational Reasoning: Proving, Not Just Testing QuickCheck checks a property on a hundred random cases and calls that good evidence. This chapter goes one step further, the way Hutton's own textbook insists on: proving a property holds for every possible list, using nothing but substitution and one genuinely simple pattern — structural induction — borrowed directly from Immutability's own promise that a binding is an equation, true forever.
VI · Back on Earth Production Haskell and the wider view
  1. 16 Laziness Practical Haskell: ByteString, Text, and Strict Data String — the type every earlier chapter quietly used — turns out to be one of Haskell's least efficient representations for real text. Text, ByteString, and the strict-by-default tools around them are what production code reaches for instead, and this chapter explains exactly when and why.
  2. 19 Pearls Common Algorithms and Data Structures A practical survey tying Pearls' Quicksort and Mergesort to the rest of the sorting landscape, showing why binary search needs the right data structure to actually be fast, and building a binary search tree from scratch before handing off to the real, production-grade Data.Map and Data.Set.
  3. 28 Laziness The Runtime System and Performance Tooling Every warning this book has given about thunk buildup and space leaks has been a claim about what happens at runtime — this chapter is how to stop taking those claims on faith and actually watch the runtime system prove or disprove them.
  4. 29 Overview The Toolbox A tour of the tools this book has used in passing since Base Camp — GHC, GHCi, Cabal, Stack, Hoogle, HLS — tied together into one map of what each one is actually for.
  5. 30 Overview Haskell Among Peaks: A Language Comparison This pilgrimage climbed one particular peak thoroughly. This closing chapter looks out at the rest of the range — nine other languages, what each one is actually for, and where to go read more.

About this pilgrimage

Like any travelogue, this is a rambling set of essays about beautiful vistas in the landscape of Functional Heaven that is Haskell — functions that mirror their mathematical counterparts, inspiration from Category Theory, lazy evaluation that lets you work with infinite data, and purity that lets you actually reason about what your program does.

Every diagram on this site is hand-drawn to match the prose it illustrates — nothing generated, nothing stock. The print/PDF edition also includes chapter exercises and worked solutions. For book and paper recommendations, see Further Reading.