-
Notifications
You must be signed in to change notification settings - Fork 1
Home
This wiki contains markdown versions of literate Haskell notes from reading Bartosz Milewski's book Category Theory for Programmers.
This is my second reading of the book. To get more out of it, I decided to dedicate some
time to finding (or coming up with) more code examples. For example, how to implement non-Hask categories,
how to express product category, etc.
This project makes these conceptual code examples public.
Category theory is a very abstract subject. I hope my notes and code will help
others struggling with CT. Internalizing Milewski's book will make all of us better programmers.
-
:
is added to type level operators, for example:.
is type level composition - code blocks without language annotations are used for proofs (like equational reasoning) or for code fragments used for documentation/reference only (like typeclass definitions imported from other packages).
- I use the term 'dependently typed' loosely to mean
DataKinds
and friends. - I use literate Haskell Bird Style and all Haskell code is converted to code block with Haskell language annotation
Mostly Ready for viewing (with some TODOs):
-
Chapter 3a. Categories (N_P1Ch03a_NatsCat) - Non-Hask example 'dependently typed' categories based on
Nat
- Chapter 3b. Categories (N_P1Ch03b_FiniteCats) - Non-Hask simple directed graph categories with GADTs and DataKinds
- Chapter 7a. Functors (N_P1Ch07_Functors_Composition) - Hask Functor Composition
-
Chapter 7b. Functors (N_P1Ch07b_Functors_AcrossCats) Non-Hask Functors (
CFunctor
) in Haskell -
N_P1Ch08a_BiFunctorAsFunctor Product category in Haskell, combining conceptual packages
category-extras
anddata-category
Bifunctor is the same asCFunctor
-
N_P1Ch08b_BiFunctorComposition Bifuntor composition presented as
CFunctor
composition. - Chapter 10. Natural Transformations Hask Natural Transformations
- N_P1Ch10b_NTsNonHask - Non-Hask Natural Transformations
Work-in-progress (reader stay away):
Mostly Ready for viewing (with some TODOs):
-
Chapter 2a. Limits and Colimits (N_P2Ch02a_LimitsColimitsExtras) -
category-extras
Limit and Colimit in the context of the book - Chapter 2b. Continuity (N_P2Ch02b_Continuity) - some not continuous Hask functors and 'dependently typed' proofs in Haskell
- Chapter 2c. Equalizer (N_P1Ch03c_Equalizer) - see how far I can go trying to define equalizer in Haskell
-
Chapter 3. Free Monoid (N_P2Ch03_FreeMonoidFoldMap) - my eureka moment that
foldMap
is free monoid construction -
Chapter 5. Yoneda (N_P2Ch05a_YonedaAndMap) - Hask Yoneda Lemma as stronger, freer, and faster
fmap
- Chapter 5. Yoneda (N_P2Ch05b_YonedaNonHask) - non-Hask Yoneda Lemma, pattern match intuition
Mostly Ready for viewing (with some TODOs):
- Chapter 12 Enriched Categories (N_P3Ch12b_EnrichedPreorder) - Preorder example.
- Chapter 15 Span Bicategory (N_P3Ch15a_Spans) - detailed notes about bicategory Span
- Chapter 15 Category as a Monad (N_P3Ch15b_CatsAsMonads) - Haskell take on "a category is just a monad in the bicategory of spans"
Work-in-progress (reader stay away):
- Chapter 2a Exponential as Adjunction (N_P3Ch02a_CurryAdj)
- Chapter 2b Non-Hask adjunction, Product as Adjunction (N_P3Ch02b_AdjNonHask)
- Chapter 2c N_P3Ch02c_AdjProps
- Chapter 6a N_P3Ch06a_CTMonads
- Chapter 6b N_P3Ch06b_FiniteMonads monads on finite categories (N_P3Ch06b_FiniteMonads)
- Chapter 7a Conway's Game of Life (N_P3Ch07a_GameOfLife)
- Chapter 7b (N_P3Ch07b_Comonad)]
- Chapter 8 (N_P3Ch08a_Falg) Notes about F-algeras, iso-equi recursion, uniqueness condition, finite example
- Chapter 9 (N_P3Ch09b_AlgebraAndFree) Loose notes about Free Monad, free-forgetful adjunction and f-algebras
- Chapter 11 Kan Extensions (N_P3Ch11a_KanExt)
- Chapter 12 Enriched Categories (N_P3Ch12a_HaskEnrich) - enriching over Hask is what we often do