In category theory, hom-sets, are sets of morphisms between objects. Given objects A and B in a locally small category, the hom-set Hom(A,B) is the set of all morphisms {→0,→1,→2,…,→n} from A to B.
Hom-sets itself give rise to another category where hom-sets are objects and arrows between hom-sets are hom-set morphisms. A hom-set morphism is defined as:
This can be translated to Hask, the category with Haskell types as objects and functions as morphisms. The previous morphisms f,h are now functions:
f :: b -> d
h :: c -> a
and Hom(A,B)=a→b, such that:
Let’s have a closer look at the morphism from a→b to c→b. So we have a a→b and a morphisms that tells us we can go c→a→b resulting in c→b. Now, this makes sense if we remember how function composition works:
We can see that c→b is the function composition g′∘f′. Thus, a hom-set morphism Hom(f,−) is simply morphism pre-composition f∘− and Hom(−,f) is just morphism post-composition −∘f. Furthermore, Hom(A,−), which you can think of as A→, is called a covariant hom-functor or representable functor from the category C to the category Set, x→HomC(A,x) with x∈C and HomC(A,x)∈Set.
When the second position is fixed Hom(−,B):Cop→Set (which you can think of as: →B) then it’s called a contravariant functor. Consequently, if non of the arguments of the hom-functor are fixed Hom(−,−):Cop×C→Set then we have a hom bifunctor also called profunctor, see for instance the diagonal arrow Hom(h,f) with pre- and post-composition.