Functors Are Mappers
In category theory, when we say one category is “like” another category, we usually mean that there is a mapping between the two. For this mapping to be meaningful, it should preserve the structure of the category. Such a mapping has a name: it’s called a functor.
—Bartosz Milewski
As we saw earlier (see Defining Functors in Code), a functor is a bit like a function, but instead of mapping elements of a set to another set, it operates on categories. The functor should map not only all the objects in the initial category, but also all the morphisms present within it. Actually, what’s really important is the mapping of morphisms, as the mapping of objects follows as a natural consequence.
Formally, a functor is a mapping ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access