Bartosz Milewski
Computers & Technology
Category Theory for Programmers
Free
Description
Contents
Reviews

For some time now I’ve been oating the idea of writing a book about category theory that would be targeted at programmers. Mind you, not computer scientists but pro- grammers — engineers rather than scientists. I know this sounds crazy and I am properly scared. I can’t deny that there is a huge gap between science and engineering be- cause I have worked on both sides of the divide. But I’ve al- ways felt a very strong compulsion to explain things. I have tremendous admiration for Richard Feynman who was the master of simple explanations. I know I’m no Feynman, but I will try my best. I’m starting by publishing this pref- ace — which is supposed to motivate the reader to learn category theory — in hopes of starting a discussion and soliciting feedback.

This is an unofficial PDF version of "Category Theory for Programmers" by Bartosz Milewski, converted from his blogpost series.

Language
English
ISBN
Unknown
Preface
I Part One
Category: The Essence of Composition
Arrows as Functions
Properties of Composition
Composition is the Essence of Programming
Challenges
Types and Functions
Who Needs Types?
Types Are About Composability
What Are Types?
Why Do We Need a Mathematical Model?
Pure and Dirty Functions
Examples of Types
Challenges
Categories Great and Small
No Objects
Simple Graphs
Orders
Monoid as Set
Monoid as Category
Challenges
Kleisli Categories
The Writer Category
Kleisli Categories
Challenge
Products and Coproducts
Initial Object
Terminal Object
Duality
Isomorphisms
Products
Coproduct
Asymmetry
Challenges
Bibliography
Simple Algebraic Data Types
Product Types
Records
Sum Types
Algebra of Types
Challenges
Functors
Functors in Programming
The Maybe Functor
Equational Reasoning
Optional
Typeclasses
Functor in C++
The List Functor
Functors as Containers
Functor Composition
Challenges
Functoriality
Bifunctors
Product and Coproduct Bifunctors
Functorial Algebraic Data Types
Functors in C++
The Writer Functor
Covariant and Contravariant Functors
Profunctors
Challenges
Function Types
Universal Construction
Currying
Exponentials
Cartesian Closed Categories
Exponentials and Algebraic Data Types
Zeroth Power
Powers of One
First Power
Exponentials of Sums
Exponentials of Exponentials
Exponentials over Products
Curry-Howard Isomorphism
Bibliography
Natural Transformations
Polymorphic Functions
Beyond Naturality
Functor Category
2-Categories
Conclusion
Challenges
II Part Two
Declarative Programming
Limits and Colimits
Limit as a Natural Isomorphism
Examples of Limits
Colimits
Continuity
Challenges
Free Monoids
Free Monoid in Haskell
Free Monoid Universal Construction
Challenges
Representable Functors
The Hom Functor
Representable Functors
Challenges
Bibliography
The Yoneda Lemma
Co-Yoneda
Challenges
Bibliography
Yoneda Embedding
The Embedding
Preorder Example
Naturality
Challenges
III Part Three
It's All About Morphisms
Functors
Commuting Diagrams
Natural Transformations
Natural Isomorphisms
Hom-Sets
Hom-Set Isomorphisms
Asymmetry of Hom-Sets
Challenges
Adjunction and Unit/Counit Pair
Challenges
Some Intuitions
Challenges
The Kleisli Category
Fish Anatomy
The do Notation
The Problem
The Solution
Partiality
Nondeterminism
Write-Only State
State
Exceptions
Continuations
Interactive Input
Interactive Output
Conclusion
Monoidal Categories
Monoid in a Monoidal Category
Dissecting the Composition
Challenges
F-Algebras
Recursion
Category of F-Algebras
Natural Numbers
Catamorphisms
Folds
Coalgebras
Challenges
T-algebras
The Kleisli Category
Lenses
Challenges
Ends and Coends
Dinatural Transformations
Ends
Ends as Equalizers
Natural Transformations as Ends
Coends
Ninja Yoneda Lemma
Profunctor Composition
Kan Extensions
Right Kan Extension
Kan Extension as Adjunction
Left Kan Extension
Kan Extensions as Ends
Kan Extensions in Haskell
Free Functor
Enriched Categories
Why Monoidal Category?
Monoidal Category
Enriched Category
Preorders
Metric Spaces
Enriched Functors
Self Enrichment
Relation to 2-Categories
Topoi
Subobject Classifier
Topos
Topoi and Logic
Challenges
Lawvere Theories
Universal Algebra
Lavwere Theories
Models of Lawvere Theories
The Theory of Monoids
Lawvere Theories and Monads
Lawvere Theory of Side Effects
Challenges