# CT: Composition¶

In category theory, composition is the joining together of two morphisms to create a new morphism.

Two morphisms $f$ and $g$ are composable if $f$s arrow ends where $g$s starts. i.e. $f : A \rightarrow B$ and $g : B \rightarrow C$ would make $f$ and $g$ composable.

Composition is described using the composition operator $\circ$, pronounced after. So $f$ composed with $g$ as described above would be written $g \circ f$, or g after f when spoken aloud.

\begin{xy} \xymatrix{ A \ar@{->}[r]^{f} \ar@/_/@{->}[rr]_{g \circ f} & B \ar@{->}[r]^{g} & C } \end{xy}

This concept is very closely related to composition in functional programming. This is because it's the same concept, where the category in question is the category of types.