explaingit

hmemcpy/milewski-ctfp-pdf

11,584TeXAudience · developerComplexity · 2/5LicenseSetup · moderate

TLDR

An unofficial PDF and LaTeX source for 'Category Theory for Programmers,' a book that explains advanced math concepts for developers using Haskell, Scala, and OCaml code examples. You can build it yourself or buy a printed copy.

Mindmap

mindmap
  root((ctfp-pdf))
    What it does
      PDF book source
      LaTeX typesetting
      Multiple editions
    Tech stack
      LaTeX
      Nix build tool
      Haskell examples
      Scala examples
    Use cases
      Self study
      Functional programming
      Print your own copy
    Audience
      Developers
      Haskell learners
      Math curious coders
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Build a PDF copy of the Category Theory book in your preferred edition: Haskell, Scala, OCaml, or Reason.

USE CASE 2

Use as a self-study resource for understanding the mathematics behind functional programming.

USE CASE 3

Reference the LaTeX source to learn how a complex technical book is typeset and compiled with Nix.

Tech stack

LaTeXNixHaskellScalaOCamlReasonMake

Getting it running

Difficulty · moderate Time to first run · 30min

Requires Nix to build the PDF automatically, a Makefile is also available for manual LaTeX installs.

Book content is Creative Commons Attribution-ShareAlike 4.0, share and adapt with credit and the same license. Build scripts are GPL.

In plain English

This repository contains an unofficial PDF and LaTeX source for "Category Theory for Programmers," a book by Bartosz Milewski that grew out of his series of blog posts on the subject. The conversion from blog posts to typeset book was done with Milewski's permission, and the result has been published in both free digital form and as a printed book available for purchase. Category theory is a branch of mathematics that has become relevant to programmers, particularly those working with functional programming languages like Haskell, Scala, and OCaml. The book explains these mathematical ideas in terms that programmers can relate to, using code examples in those languages. You do not need a mathematics background to start reading it, though it does build up to advanced concepts over time. The repository provides the full LaTeX source so you can build the PDF yourself. The build process uses a tool called Nix to manage dependencies, which means you do not have to manually install a LaTeX environment. Running a single command produces a PDF file in a format you choose: the standard Haskell edition, a Scala edition, an OCaml edition, or a Reason edition. A Makefile is also available for those who prefer to build without Nix. If you want a physical copy rather than a PDF, both a full-color hardcover edition and a Scala paperback edition were published in August 2019 and are available through a print-on-demand service called Blurb. The repository also tracks errata for those printed editions. The book content is licensed under Creative Commons Attribution-ShareAlike 4.0, which means you can share and adapt it as long as you give credit and use the same license. The build scripts are licensed under the GNU General Public License.

Copy-paste prompts

Prompt 1
I want to understand category theory as a programmer. Walk me through the concept of functors using Haskell code examples from 'Category Theory for Programmers.'
Prompt 2
Using ideas from 'Category Theory for Programmers,' explain how monads work in a way a JavaScript developer can understand.
Prompt 3
I'm reading 'Category Theory for Programmers' and stuck on natural transformations. Give me a practical Scala example that makes it concrete.
Prompt 4
How do I build the OCaml edition PDF from this LaTeX repo using Nix, what command do I run?
Open on GitHub → Explain another repo

← hmemcpy on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.