
Hi there! I've heard several times that some Haskell type classes and methods are ill-named. For instance, a functor can be both covariant and contravariant, while Haskell `Functor` typeclass i just covariant. Would `Cofunctor` be a better name for it? And what about the `fmap` method? Would it be better to call it `comap`? How about `Bifunctor`, `Profunctor` and others? Thanks, Marc Busqué http://waiting-for-dev.github.io/about/

Hi Marc, On Wed, Apr 22 2020 11:17, Marc Busqué wrote:
For instance, a functor can be both covariant and contravariant
Judging from personal experience, "functor" in mathematics always (for a sufficiently small definition of always) refers to a covariant functor. If something is contravariant you usually declare it explicitly. These concepts are rather related though; one may view any contravariant functor F: C -> D as a covariant one, either by F: C^o -> D or by F: C -> D^o.
Would `Cofunctor` be a better name for it?
Cofunctor has some ambiguity around it. While it might refer to a contravariant functor it may as well refer to the dual of a functor (which is again a functor). Cheers, -- Tony Zorman | PGP: 0xc927de8c7dfd57b8

Pretty sure cofunctors are functors :p In any case, I think the name “functor” is pretty apt, makes some sense compared to what I’d learned in algebra. Cheers, Vanessa McHale
On Apr 22, 2020, at 4:50 AM, Tony Zorman
wrote: Hi Marc,
On Wed, Apr 22 2020 11:17, Marc Busqué wrote:
For instance, a functor can be both covariant and contravariant
Judging from personal experience, "functor" in mathematics always (for a sufficiently small definition of always) refers to a covariant functor. If something is contravariant you usually declare it explicitly. These concepts are rather related though; one may view any contravariant functor F: C -> D as a covariant one, either by F: C^o -> D or by F: C -> D^o.
Would `Cofunctor` be a better name for it?
Cofunctor has some ambiguity around it. While it might refer to a contravariant functor it may as well refer to the dual of a functor (which is again a functor).
Cheers, -- Tony Zorman | PGP: 0xc927de8c7dfd57b8 _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.

On Wed, Apr 22 2020 17:17, Vanessa McHale wrote:
Pretty sure cofunctors are functors :p
Indeed! What I meant to say was that the dual of a (covariant) functor is again a (covariant) functor, not a contravariant one and hence you again have the confusion as to which *kind* of functor the name should refer to. Cheers, -- Tony Zorman | PGP: 0xc927de8c7dfd57b8
participants (3)
-
Marc Busqué
-
Tony Zorman
-
Vanessa McHale