Function composition is associative

So, function composition does not commute, but it is associative:

That diagram says that we can compose our functions to get from A to D by either choosing the upper (A→CD) path or the lower (ABD) path.

The idea of a functor is that it translates the diagrams we can draw in one category into diagrams in another category. This often lets us convert ideas and theorems from one category into another.

Let's look at an example of a particular functor, the forgetful functor, to get a better feel for what it means to convert things from one category into another.

Get Learning Functional Programming in Go now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.