# 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 fs arrow ends where gs 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.

## Backlinks¶

- Category Theory
- At the core of category theory is, unsurprisingly, the category. A category is a collection of objects and morphisms, where each object has at least an 'identity morphism'. A morphism is an arrow pointing from one object to another. Objects exist as named points to give the morphisms context. Category theory concerns itself with the composition of morphisms within different categories and the different states that are possible.

- Compose notes
- When building new knowledge, compose small notes together to create new networks of ideas.

- Any graph can be made into a category
- Graphs can represent a category. It's possible to turn a graph that doesn't into a category by adding more edges. First, ensuring that each node has an identity morphism, then adding an edge for each pair of adjacent edges to satisfy the requirement for composition.