Proposal: Add conspicuously missing Functor instances for tuples

Conal Elliott conal at conal.net
Tue Feb 23 18:54:00 UTC 2016


Strongly +1 from me. I very highly value instances of standard type classes
for standard type constructions, particularly products, sums, and
functions, not just for some library wrappers around them. And consistency
usually ends up the best practical choice, whether or not many uses are
clear beforehand.

On Tue, Jan 19, 2016 at 6:38 AM, Edward Kmett <ekmett at gmail.com> wrote:

> +1 from me.
>
> We routinely supply instances for tuples of up to 4 or 5 elements
> elsewhere.
>
> There is no need to be randomly inconsistent here.
>
> -Edward
>
> On Mon, Jan 18, 2016 at 3:10 PM, David Feuer <david.feuer at gmail.com>
> wrote:
>
>> For some reason I really can't imagine, it seems the only tuple type
>> with a Functor instance is (,) a. I was astonished to find that
>>
>> fmap (+1) (1,2,3)
>>
>> doesn't work. Since this is *useful*, and there is *only one way to do
>> it*, I propose we add the following:
>>
>> instance Functor ((,,) a b) where
>>   fmap f (a,b,c) = (a,b,f c)
>> instance Functor ((,,,) a b c) where
>>   fmap f (a,b,c,d) = (a,b,c,f d)
>> etc.
>>
>> I would really love to see these make 8.0.0, but if that's impossible
>> then so be it.
>> _______________________________________________
>> Libraries mailing list
>> Libraries at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>>
>
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20160223/1f51badc/attachment.html>


More information about the Libraries mailing list