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

Daniel Peebles pumpkingod at gmail.com
Fri Dec 24 03:41:50 CET 2010


For me, mostly naming. Cofunctor isn't the right name for it, and comap,
while short, feels wrong. Contrafunctor feels better but is also cumbersome.
No problems with Comonad, though.

On Thu, Dec 23, 2010 at 9:16 PM, Mario Blažević <mblazevic at stilo.com> wrote:

>
> On Thu, Dec 23, 2010 at 5:25 PM, Stephen Tetley <stephen.tetley at gmail.com>wrote:
>
>> On 23 December 2010 21:43, Mario Blažević <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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20101223/ceedb1e4/attachment.htm>


More information about the Haskell-Cafe mailing list