
On 7/10/07, Andrew Coppin
Stefan O'Rear wrote:
On Tue, Jul 10, 2007 at 08:08:52PM +0100, Andrew Coppin wrote:
Erm... Wait a sec... coroutines, comonads, coprograms, codata... what in the name of goodness does "co" actually *mean* anyway?? Nothing. When mathematicians find a new thing completely unlike an OldThing, but related by some symmetry, they often call the new thing a CoOldThing.
(I got lost somewhere with the levels of quotation there...) It's more specific than this. Coalgebra, cohomology, codata, comonads and so on derive their name from the fact that they can be described using category theory. In category theory you draw lots of diagrams with arrows in them. When you flip all the arrows round you get a description of something else. Pairs of concepts connected in this way often differ by the prefix "co-". Often theorems you prove about objects have analogous theorems about the respective co-objects. In fact, often the proof is the same, just written with all the arrows pointing the other way. This carries over to Haskell too. You can sometimes write functional (as in useful) code simply by taking an already existing piece of code and figuring out what flipping the arrows means. It often means something very different, but it still makes sense. A really cool example is the relationship between fold and unfold. But I'll leave that for someone else. -- Dan