Awesome Open Source
Awesome Open Source

Category Theory for Programmers

image Direct link: category-theory-for-programmers.pdf
(Latest release: v1.3.0, August 2019. See releases for additional formats and languages.)

Build Status
(latest CI build)

Buy Category Theory for Programmers
Available in full-color hardcover print
Publish date: 12 August, 2019. Based off release tag v1.3.0. See errata-1.3.0 for changes and fixes since print.

Scala Edition is now available in paperback
Publish date: 12 August, 2019. Based off release tag v1.3.0. See errata-scala for changes and fixes since print.

This is an unofficial PDF version of "Category Theory for Programmers" by Bartosz Milewski, converted from his blogpost series (with permission!)


The best way to build the book is using the Nix package manager. After installing Nix, if you're using a non-NixOS operating system, you need to install nixFlakes in your environment following the steps below (source):

$ nix-env -iA nixpkgs.nixFlakes

Edit either ~/.config/nix/nix.conf or /etc/nix/nix.conf and add:

experimental-features = nix-command flakes

This is needed to expose the Nix 2.0 CLI and flakes support that are hidden behind feature-flags.

Also, if the Nix installation is in multi-user mode, don’t forget to restart the nix-daemon.

Afterwards, type nix flake show in the root directory of the project to see all the available versions of this book. Then type nix build .#<edition> to build the edition you want (Haskell, Scala, OCaml, Reason and their printed versions). For example, to build the Scala edition you'll have to type nix build .#ctfp-scala.

Upon successful compilation, the PDF file will be placed in the result directory inside the root directory milewski-ctfp-pdf of the repository.

The file preamble.tex contains all the configuration and style declarations.


PDF LaTeX source and the tools to create it are based on the work by Andres Raba et al., available here:
The book content is taken, with permission, from Bartosz Milewski's blogpost series, and adapted to the LaTeX format.

Thanks to the following people for contributing corrections/conversions and misc:

  • Oleg Rakitskiy
  • Jared Weakly
  • Paolo G. Giarrusso
  • Adi Shavit
  • Mico Loretan
  • Marcello Seri
  • Erwin Maruli Tua Pakpahan
  • Markus Hauck
  • Yevheniy Zelenskyy
  • Ross Kirsling
  • ...and many others!

The original blog post acknowledgments by Bartosz are consolidated in the Acknowledgments page at the end of the book.

Note from Bartosz: I really appreciate all your contributions. You made this book much better than I could have imagined. Thank you!


The PDF book, .tex files, and associated images and figures in directories src/fig and src/content are licensed under Creative Commons Attribution-ShareAlike 4.0 International License (cc by-sa).

The script files and others are licensed under GNU General Public License version 3 (for details, see LICENSE).

Alternative Project Comparisons
Related Awesome Lists
Top Programming Languages
Top Projects

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
C Plus Plus (235,942
Scala (28,594
Book (20,262
Haskell (20,237
Tex (19,365
Functional Programming (10,953
Latex (10,061
Ocaml (6,660
Category Theory (261