A coend is a gadget to glue two profunctors together.
A profunctor is a gadget to glue categories together.
A category is a gadget to glue pairs of objects together.
So... there's a cherry tree C above, and some dark blueberry shrubs D at our feet. A spider named P (friends call him Pavuk) has cast a thread p(c,d) from a cherry c to a darkberry d.
This picture seems kind of enough to understand coends, but let's have a look at a property of profunctors that helps motivate how we might end up having many arrows in each resulting set.
Our example will be the hom-profunctor. It maps pairs of objects c,d from categories C and D to sets of arrows:
P: (C^op,D)->Set
p(c,d) = hom(c,d)
Now this picture really is enough to understand why P's first argument is contravariant! C^op is the opposite of C, with all arrows reversed. Check this out:
I have p(c,d) and I now want to connect different objects p(c',d') with help of arrows from C and D. These would work:
f: c'->c
g: d->d'
See how they point in opposite directions? The first arrow f needs to connect to the tail of p(c,d), the second to its head!
We say that f and g can be lifted to a profunctor p(c',d').
And here we come to the heart, the axiomatic description of what a profunctor is:
dimap: (C->C,D->D,P)->P
dimap(f,g,p(a,b))
P is a profunctor when we have a dimap implementation.
Do you also have an itch to write p(c,d) using an arrow? Also, what about hom(c,d)?:
p(c,d) = c->d = hom(c,d)
You can tell we are doing category theory, because I keep invoking new words like excuses. You can tell, because all those words end up saying almost the same.
1/3