A functor maps the objects of one category to another while preserving morphisms and their composition. It transfers structure rather than merely transforming values. A covariant functor preserves arrow direction; a contravariant functor reverses it. When both categories are the same, the functor is an endofunctor. section 7.4
Read a functor through three connected ideas:
- Treat objects as arbitrary entities and morphisms as arrows expressing how one object relates to or reaches another. section 7.1
- Use covariance when relationships retain direction, and contravariance when the same relationships reverse direction. section 7.4
- Interpret assignment compatibility between types as a morphism; generic interfaces can then behave like covariant or contravariant functors. section 7.4
Mapping a small category
A C# function such as `string F(int i) => family[i]` maps integer objects to names. Thinking categorically adds a further requirement: the mapping must preserve the relevant arrows between those objects, not just produce an output for each input. section 7.1
Figure 7.3 The function F is represented as dashed arrows mapping from one category to another.
A diagram makes the functor visible as dashed arrows mapping one category's objects into another. section 7.1





