In category theory, hom-sets, are sets of morphisms between objects. Given objects $A$ and $B$ in a locally small category, the hom-set $\text{Hom}(A,B)$ is the set of all morphisms $\{\rightarrow_0,$$\rightarrow_1,$$\rightarrow_2,$$\dots,$$\rightarrow_n\}$ from A to B.

\begin{xy} \xymatrix{ A \[email protected]/^/[r] \[email protected]/^1pc/[r] \ar[r] \[email protected]/_/[r] \[email protected]/_1pc/[r] & B } \end{xy}

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:

$\text{Hom}(A,f) : \text{Hom}(A,B) \rightarrow \text{Hom}(A,D)$, $f’ \rightarrow$ $f \circ {f'}$ for $f : B \rightarrow D$

$\text{Hom}(h,B) : \text{Hom}(A,B) \rightarrow \text{Hom}(C,B)$, $h’ \rightarrow$ $h' \circ {h}$ for $h : C \rightarrow A$

such that the following diagram commutes:

\begin{xy} \[email protected][email protected]!R=1.0cm{ \text{Hom}(A,B) \ar[dr]|-{\text{Hom}(h,f)} \ar[d]_{\text{Hom}(A,f)} \ar[r]^{\text{Hom}(h,B)} & \text{Hom}(C,B) \ar[d]^{Hom(C,f)} \\ \text{Hom}(A,D) \ar[r]_{\text{Hom}(h,D)} & \text{Hom}(C,D) } \end{xy}

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 $\text{Hom}(A,B) = a \rightarrow$ b, such that:

\begin{xy} \[email protected][email protected]!R=1.0cm{ a \rightarrow b \ar[dr]|-{c\ \rightarrow\ a\ \rightarrow\ b\ \rightarrow\ d} \ar[d]_{a\ \rightarrow\ b\ \rightarrow\ d} \ar[r]^{c\ \rightarrow\ a\ \rightarrow\ b} & c \rightarrow b \ar[d]^{c\ \rightarrow\ b\ \rightarrow\ d} \\ a \rightarrow d \ar[r]_{c\ \rightarrow\ a\ \rightarrow\ d} & c \rightarrow d } \end{xy}

Let’s have a closer look at the morphism from $a \rightarrow b$ to $c \rightarrow b$. So we have a $a \rightarrow b$ and a morphisms that tells us we can go $c \rightarrow a \rightarrow b$ resulting in $c \rightarrow b$. Now, this makes sense if we remember how function composition works:

\begin{xy} \xymatrix { c \ar[r]^{f'} \ar[dr]_{g' \circ {f'}} & a \ar[d]^{g'} & \\ & b &&&&& } \end{xy}

We can see that $c \rightarrow b$ is the function composition $g' \circ {f'}$. Thus, a hom-set morphism $\text{Hom}(f,-)$ is simply morphism pre-composition $f \circ -$ and $\text{Hom}(-,f)$ is just morphism post-composition $- \circ f$. Furthermore, $\text{Hom}(A,-)$, which you can think of as $A \rightarrow$, is called a covariant hom-functor or representable functor from the category $C$ to the category $Set$, $x \rightarrow \text{Hom}_C(A,x)$ with $x \in C$ and $\text{Hom}_C(A,x) \in Set$. When the second position is fixed $\text{Hom}(-,B): C^{op} \rightarrow Set$ (which you can think of as: $\rightarrow B$) then it’s called a contravariant functor. Consequently, if non of the arguments of the hom-functor are fixed $\text{Hom}(−,−): C^{op} \times C \rightarrow Set$ then we have a hom bifunctor also called profunctor, see for instance the diagonal arrow $\text{Hom}(h,f)$ with pre- and post-composition.