-
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 - Chapter 10. Natural Transformations Hask Natural Transformations
Work-in-progress (reader stay away):
- N_P1Ch03c_DiscreteCats
-
N_P1Ch08a_BiFunctorAsFunctor Product category Hask x Hask (or not-Hask x not-Hask) in Haskell, combining conceptual packages
category-extras
anddata-category
Bifunctor is the same asCFunctor
- N_P1Ch08b_BiFunctorComposition
- N_P1Ch10b_NTsNonHask - Non-Hask Natural Transformations
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
Work-in-progress (reader stay away):
- Chapter 5. Yoneda (N_P2Ch05b_YonedaNonHask) - non-Hask Yoneda Lemma, pattern match intuition
Mostly Ready for viewing (with some TODOs): (soon)
Work-in-progress (reader stay away):