Functor
a functor is a mapping between categories,
F โถ ๐ โ ๐
an identity functor maps a category back to itself,
F โถ ๐ โ ๐
a functor does the mapping by using 2 morphisms:
Fโ : a -> F a
for mapping objects to objectsFโ : f -> F f
for mapping arrows to arrows
Functors are one of the fundamental elements of category theory. Functors allow for translation between different branches of mathematics and they play an important role in FP where they, among other things, facilitate defining container types, or, more generally, type constructors.
A functor (also called "morphism of categories") is a mapping between categories, F โถ ๐ โ ๐
: not only it maps objects in ๐
to objects in ๐
, but it also maps morphisms in ๐
to morphisms in ๐
.
The identity functor maps a category, ๐
, back to itself, Fษชแด
: ๐ โ ๐
by mapping each object in ๐
to itself, and each arrow in ๐
to itself.
A functor F
maps between categories ๐
and ๐
using its two component morphisms, one for mapping objects and the other for mapping arrows:
component morphism
Fโ
that maps each objecta
in๐
to an objectF a
in๐
with signatureFโ : a โ F a
component morphism
Fโ
that assigns to each arrowf : a โ b
in๐
, an arrowF f : F a โ F b
in๐
such thatF (g โฆ f) = F g โฆ F f
andF 1แด = 1๊ฐโ
===============================================================================
Definition Let `๐` and `๐` be categories. A functor `F โถ ๐ โ ๐` (consisting of two "subfunctors", `Fโ` for maping obj, and `Fโ` for arrows) assigns to each object `a` in `๐` an object `Fโ a` in `๐`, and to each morphism `f โถ a โ b` in `๐` a morphism `Fโ f โถ Fโ a โ Fโ b` in `๐`, such that, for all objects `a` in `๐`, `Fโ (idแด) = id๊ฐแด`, and, for all morphisms `f โถ a โ b` and `g โถ b โ c` in `๐`, `Fโ (g โ f) = Fโ (g) โ Fโ (f)`.
===============================================================================
Functors are composable which allows us to define the category of (small) categories, ๐๐ฎ๐
, where objects are categories, morphisms are functors, and identity arrows are identity functors.
[FAQ] Objects in a category are connected by arrows, and object across categories are connected by functors. However, an identity functor maps objects to themselves in a category, meaning objects can be mapped by arrows and functors (just saying).
A functor from a category to itself is called an endofunctor.
An example of functors is the power set operation, which yields an endofunctor in Set.
Last updated
Was this helpful?