Law of associativity

In the following diagram, we see that we can get from A to C by way of the g o f composition.

From C, we can get to D using the h arrow, which we can write as ho(gof).

Note that this is the same as h(f(g)). This notation seems more intuitive than using the composition operation, but they mean the same thing.

From the following diagram, we see that ho(gof) is the same as (hog)of.

So, our category obeys the law of associativity. The next diagram is another illustration of the associativity of composition:

That diagram says ...

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.