Functor is a mapping between two categories. It maps both objects and morphisms from one category to the other.
Here’s an example of morphism F that is a mapping between categories C and D:
A category would translate to a generic type like
List<T> in C#. A
Select method on it allows us to go from
List<T> is a functor.
In general, generics are often candidates for functors, they just need to adhere to functor laws. It doesn’t mean though that only generic types fall under the functors umbrella.
Mapping an indentity function returns the functor unchanged.
if you have two functions,
g, then mapping over one after the other should be the same as mapping over the composition of
Examples of functors include: