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

Tony Morris tonymorris at gmail.com
Fri Dec 24 05:25:01 CET 2010


-----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.

On 24/12/10 12:16, Mario Blažević wrote:
>
> On Thu, Dec 23, 2010 at 5:25 PM, Stephen Tetley
> <stephen.tetley at gmail.com <mailto:stephen.tetley at gmail.com>>
> wrote:
>
> On 23 December 2010 21:43, Mario Blažević <mblazevic at stilo.com
> <mailto:mblazevic at stilo.com>> wrote:
>> Why are Cofunctor and Comonad classes not a part of the base
> library? [SNIP]
>> Later on I found that this question has been raised before by
> Conal Elliott,
>> nearly four years ago.
>>
>>
> http://www.haskell.org/pipermail/libraries/2007-January/006740.html
>
>
>
>
- From a somewhat "philistine" persepective, that Conal's question
> went unanswered says something:
>
> "Does anyone have useful functionality to go into a Cofunctor
> module (beyond the class declaration)?"
>
> Successful post-H98 additions to Base (Applicative, Arrows, ...)
> brought a compelling programming style with them. For Comonads,
> Category-extras does define some extra combinators but otherwise
> they have perhaps seemed uncompelling.
>
>
>
> There are plenty of potential Cofunctor instances on Hackage, as
> I've pointed out. The other side of the proof of the utility of
> the class would be to find existing libraries that could be
> parameterized by an arbitrary functor: in other words, some
> examples in Hackage of
>
>> class Cofunctor c => ... instance Cofunctor c => ... f ::
>> Cofunctor c => ...
>
> This would be rather difficult to prove - such signatures cannot
> be declared today, and deciding if existing declarations could be
> generalized in this way would require a pretty deep analysis. The
> only thing I can say is "build it and they will come".
>
> To turn the proof obligation around, what could possibly be the
> downside of adding a puny Cofunctor class to the base library?
>
>
>
> _______________________________________________ Haskell-Cafe
> mailing list Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe


- -- 
Tony Morris
http://tmorris.net/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk0UIJ0ACgkQmnpgrYe6r62kWgCeNwZnYLetOFevK6bpCBE/joKO
2QQAniaX4IGzAmdjEC8kdDV27upUTsBw
=NP27
-----END PGP SIGNATURE-----

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20101224/59f0d1a6/attachment.htm>


More information about the Haskell-Cafe mailing list