I was reading about functors in scala and decided to draw a picture of an example functor
The outermost rectangles are categories, with the inner rectangles represent objects, in this example Scala types. The inner arrows are morphisms between objects, while the outer arrows represent the functors themselves, with List as the type constructor. Functors map categories, made up of objects and morphisms, so here we have
- The object Int is mapped to the object List[Int]
- The morphism Int.toString() is mapped to the morphism List[Int].map(Int.toString())
Note that morphisms map objects in the sense of their constituents, whereas functors map the objects themselves (as they are one of the constituents of the category).