Summary
This post is based on “A pragmatic introduction to category theory” talk where were presented definitions of the most used term from theory category defined from the pragmatic perspective. I encourage all of you to watch slides or presentation.
Why should we bother at all?
Category theory gives us a more in-depth understanding of our code. Precisely it gives us information about how things compose together. We reason by composition and abstraction.
Defined terms of `Theory of category` in this talk
- What is the category?
It is transformation from one object to another A->B
- The most used category’s rules
- Identity law
- Composition Low: ability to combine transformation
- Associativity: operations can be grouped arbitrarily
- monoid = category with 1 object
It meets following rules:
Identity : n o id == id o n == n
Composition : forall x, y => x o y
Associativity : x o (y o z) == (x o y) o z
- functor = category in a box (e.g. Option from F#, Future from Scala, Try, List, Either) where box means that values are lifted to some context.
It meets following rules:
Identity : map(id) == id
Composition : map(g o f) == map(g) o map(f)
Associativity: map(h o g) o map(f) == map(h) o map(g o f)
*applicative = combine more boxes into one
- monad = fuse two boxes together = it is a monoid in the category of endofunctors
[…] Theory of category […]
LikeLike