Re: [Haskell-cafe] (Co/Contra)Functor and Comonad

On Thu, Dec 23, 2010 at 11:25 PM, Tony Morris
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
...regardless of the utility of a contravariant functor type-class, I strongly advocate for calling it Contrafunctor and not Cofunctor. I have seen numerous examples of confusion over this, particularly in other languages.
I don't personally care what's it called, as long as it's available. Can anybody point to an authoritative source for the terminology, though? Wikipedia claims that cofunctor is a contravariant functor. Also, is there anything in category theory equivalent to the Functor -> Applicative -> Monad hierarchy , but with a Cofunctor/Contrafunctor at the base? I'm just curious, I'm not advocating adding the entire hierarchy to the base library. ;)

On Thu, Dec 23, 2010 at 11:46 PM, Mario Blažević
I don't personally care what's it called, as long as it's available. Can anybody point to an authoritative source for the terminology, though? Wikipedia claims that cofunctor is a contravariant functor.
Does nLab count as sufficiently authoritative? As far as I can tell it just uses "contravariant functor" if anything, and never uses "cofunctor". c.f. http://ncatlab.org/nlab/show/contravariant+functor
Also, is there anything in category theory equivalent to the Functor -> Applicative -> Monad hierarchy , but with a Cofunctor/Contrafunctor at the base? I'm just curious, I'm not advocating adding the entire hierarchy to the base library. ;)
As far as I understand (which may not actually be all that far), contravariant functors just go to or from an opposite category, a distinction that is purely a matter of definition, not anything intrinsic. On the other hand, Applicative and Monad are based on endofunctors specifically, i.e. functors from a category to itself, which would seem to necessarily exclude functors from a category to its opposite. There may exist constructs specifically based on such contravariant "endofunctors" but I doubt they'd be *equivalent* to things like Applicative/Monad in any particular way. - C.

On 12/24/10 12:26 AM, C. McCann wrote:
As far as I understand (which may not actually be all that far), contravariant functors just go to or from an opposite category, a distinction that is purely a matter of definition, not anything intrinsic.
Yes.
On the other hand, Applicative and Monad are based on endofunctors specifically, i.e. functors from a category to itself, which would seem to necessarily exclude functors from a category to its opposite.
Except for when the category is self-dual (i.e., C = C^op). But self-duality brings all sorts of other fun things into play as well. -- Live well, ~wren

On 12/23/10 11:46 PM, Mario Blažević wrote:
On Thu, Dec 23, 2010 at 11:25 PM, Tony Morris
wrote: ...regardless of the utility of a contravariant functor type-class, I strongly advocate for calling it Contrafunctor and not Cofunctor. I have seen numerous examples of confusion over this, particularly in other languages.
I don't personally care what's it called, as long as it's available. Can anybody point to an authoritative source for the terminology, though? Wikipedia claims that cofunctor is a contravariant functor.
Cofunctor = Functor. That is, given a functor F : C -> D, the dual is F^op : C^op -> D^op. On objects this is defined by F^op(X) = (F X)^op, which is equal to F X since duality doesn't change objects. And on morphism it's defined by F^op(f) = (F f^op)^op, but since f comes from C^op this is exactly the same thing as F^op(g^op) = (F g)^op where g is in C. So taking the dual of g and applying F^op is the same as applying F and then taking the dual. Thus, F^op is essentially identical to F and does the exact same thing. It just happens to have a slightly different type since it's the dual copy that lives on the other half of Cat. Whereas contravriant functors are those functors that can be visualized as some F : C -> D^op (or F : C^op -> D if you prefer; just as functor = cofunctor, so too contrafunctor = co-contrafunctor). Contravariant functors are "just functors" from a categorical perspective, though we tend to prefer thinking of them as some action between C and D instead of between one of those and the dual of the other. -- Live well, ~wren
participants (3)
-
C. McCann
-
Mario Blažević
-
wren ng thornton