Imagine it as a more generic version of class in OOP.
A collection of objects and arrows. Objects are things. Arrows take objects and return objects in the same category.
You can imagine a class in OOP as a category, its instances as objects and its methods as arrows. A category doesn't have to have objects of same type. Arrows can work on a subset of objects. We can write functions to modify both objects and arrows. We can move an object or arrow from a category to another one.
A function from one category to another one. Functors may lose information but they preserve the essence of categories.
For example a functor from Array to Set loses ordering and duplicates but these information aren't useful in a Set. A functor from Array to Array can lose the ordering without compromising what we can do with an array.
A pair of adjoint functors composed together.
For example we have two functors
- A: JSON -> Array
- B: Array -> JSON If we compose these two together we get a functor from JSON to itself. This functor goes from JSON to Array and back. Since it does that it can let us work on the array to modify json.
A Monad takes us from a category to another one and back. This means we can warp ourself to any other category that we have a Monad for, do whatever we want in that category and observe the results in our current category.
- Upper case identifiers are type classes.
>
is bind. Id>
is equivelant to:|(Id) > func |:
:|
and|:
are adjoint functors. From an arbitrary category to array and back.:|(Id)
is a functor from current type to Id.|
is an infix operator identical tofilp (.)
aka left compose.- Lines before
---
are raw data injected into code. &Id
makes every line start withId >