1.6 KiB
1.6 KiB
In this post I will explore the algebraic properties of Haskell’s
types, give an informal description of category theory, F-algebras,
homomorphisms, catamorphisms and a roundabout way to write a
foldr
that recurses backwards.
Algebra on types in Haskell
- Basic algebraic properties
- Products, Either, Functions
- Non-recursive datatypes
- Algebraic equivalences over types
Thinking with functions
- Towards category theory
- Initial objects
- Generalized elements
From functions to morphisms
- What is a category?
- All about morphisms
- Explain commuting diagrams somewhere here?
- Products
- Sums
- Exponents
Functors in category theory
- Functors
- Endofunctors
Algebra through functors
- Algebra in a category
- Monoidal object
- Use this to motivate F-algebras
- Homomorphism
- relate to classical concept of homomorphisms
- some examples
- Homomorphism
Datatypes through fixpoints
- Recursive types in haskell as fixpoints of functors
- Initial algebra fixpoints
- Construction
- Catamorphisms
- Some examples of familiar datatypes described in this way
- How catamorphisms compute backwards
Writing foldr
- Recovering
foldr
???
- Recommendations
- Category theory for programmers
- Ther are many category theory books
Bonus: monoids in the category of endofunctors
- monads are monoids in the category of endofunctors
- category of endofunctors
- natural transformations
- relate monoid example from before
- multiplication given by composition instead of \times
- category of endofunctors