<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div><br></div><div>El 19 ene 2016, a las 16:22, Christopher Allen <<a href="mailto:cma@bitemyapp.com">cma@bitemyapp.com</a>> escribió:<br><br></div><blockquote type="cite"><div><div dir="ltr"><span style="font-size:12.8px">>Why I'm not quite convinced about large tuples being entirely silly:</span><br style="font-size:12.8px"><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">They happen to be a useful dumb type for things like rows you parse from a csv file or similar as well. Pretty sure the various *-simple database clients use this as well.</span></div><div><span style="font-size:12.8px"><br></span></div></div></div></blockquote><div><br></div><div>In these cases large tuples are useful, but a Functor instance that operates on the last element?</div><br><blockquote type="cite"><div><div dir="ltr"><div><span style="font-size:12.8px">They are, admittedly, sort of a paradigm case for why `lens` is often more useful than Functors, but Functor isn't going anywhere and there's only one valid instance for these types so they might as well live with the types or the class.</span></div></div><div class="gmail_extra"><br></div></div></blockquote><div><br></div><div>My disagreement is only in "might as well": there is a downside to these, so I'd like there to be an upside (that's worth it!).</div><div><br></div><div>Tom</div><div><br></div><br><blockquote type="cite"><div><div class="gmail_extra"><div class="gmail_quote">On Tue, Jan 19, 2016 at 3:20 PM, David Feuer <span dir="ltr"><<a href="mailto:david.feuer@gmail.com" target="_blank">david.feuer@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The problem, I think, is that<br>
<br>
1. Many of us thing the instance for pairs is useful. Some of us think<br>
the instance for triples is occasionally useful. Most of us doubt the<br>
instances for large tuples are often useful (but I'm not quite<br>
convinced).<br>
2. Most of us value consistency very highly. Even if we think the<br>
instance for pairs is great and the instance for septuples is silly,<br>
we want to have the same answer for all tuple sizes.<br>
<br>
Thus we have the usual "The axiom of choice is obviously true, the<br>
well-ordering principle is obviously false, and who can say about<br>
Zorn's lemma."<br>
<br>
Why I'm not quite convinced about large tuples being entirely silly:<br>
people do weird things with Template Haskell. When they do so, they<br>
want to be able to use functions as uniformly as possible. A function<br>
(fmap) that always hits the last component of a tuple, even if it has<br>
15 components, may be just what they need.<br>
<div class="HOEnZb"><div class="h5"><br>
On Tue, Jan 19, 2016 at 4:04 PM, <<a href="mailto:amindfv@gmail.com">amindfv@gmail.com</a>> wrote:<br>
> If the only uses we can imagine for these instances are<br>
> - Cases where it's not a great design decision<br>
> - Cases where it's used accidentally and results in a silent runtime<br>
> failure instead of a compile-time error<br>
><br>
> then I'm a strong -1<br>
><br>
> Tom<br>
><br>
> El 19 ene 2016, a las 15:54, Alois Cochard <<a href="mailto:alois.cochard@gmail.com">alois.cochard@gmail.com</a>><br>
> escribió:<br>
><br>
> I don't have any use case like that. I'm in favor of this proposal for<br>
> consistency sake.<br>
><br>
> That last part of my comment about usefulness/discouraging usage was about<br>
> using Functor instance on tuple in general, no matter the arity.<br>
><br>
> On 19 January 2016 at 21:32, <<a href="mailto:amindfv@gmail.com">amindfv@gmail.com</a>> wrote:<br>
>><br>
>> El 19 ene 2016, a las 10:24, Alois Cochard <<a href="mailto:alois.cochard@gmail.com">alois.cochard@gmail.com</a>><br>
>> escribió:<br>
>><br>
>> +1<br>
>><br>
>> Agree for consistency, I can also see those instances as being useful in<br>
>> some specific context, even if I agree with Andreas that in general they<br>
>> should be discouraged (especially for newcomers).<br>
>><br>
>><br>
>> Can you give us an example where using e.g. the Functor instance for a<br>
>> 5-tuple would be the correct/best design decision?<br>
>><br>
>> Tom<br>
>><br>
>><br>
>><br>
>> On 19 January 2016 at 09:20, Herbert Valerio Riedel <<a href="mailto:hvriedel@gmail.com">hvriedel@gmail.com</a>><br>
>> wrote:<br>
>>><br>
>>> On 2016-01-18 at 21:10:07 +0100, David Feuer wrote:<br>
>>> > For some reason I really can't imagine, it seems the only tuple type<br>
>>> > with a Functor instance is (,) a. I was astonished to find that<br>
>>> ><br>
>>> > fmap (+1) (1,2,3)<br>
>>> ><br>
>>> > doesn't work. Since this is *useful*, and there is *only one way to do<br>
>>> > it*, I propose we add the following:<br>
>>> ><br>
>>> > instance Functor ((,,) a b) where<br>
>>> > fmap f (a,b,c) = (a,b,f c)<br>
>>> > instance Functor ((,,,) a b c) where<br>
>>> > fmap f (a,b,c,d) = (a,b,c,f d)<br>
>>> > etc.<br>
>>><br>
>>> As stated elsewhere in this thread already, there is the issue about<br>
>>> consistency. Here's a relevant section from the Haskell 2010 report[1]:<br>
>>><br>
>>> > 6.1.4 Tuples<br>
>>> ><br>
>>> > ...<br>
>>> ><br>
>>> > However, every Haskell implementation must support tuples up to size<br>
>>> > 15, together with the instances for Eq, Ord, Bounded, Read, and Show.<br>
>>><br>
>>> IMO, we either have no `Functor` instances for tuples at all, or we have<br>
>>> them for all tuples up to size 15. The current situations of having them<br>
>>> defined only for 2-tuples is inconsistent.<br>
>>><br>
>>><br>
>>> Cheers,<br>
>>> hvr<br>
>>><br>
>>> [1]:<br>
>>> <a href="https://www.haskell.org/onlinereport/haskell2010/haskellch6.html#x13-1210006.1.4" rel="noreferrer" target="_blank">https://www.haskell.org/onlinereport/haskell2010/haskellch6.html#x13-1210006.1.4</a><br>
>>> _______________________________________________<br>
>>> Libraries mailing list<br>
>>> <a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br>
>>> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
>><br>
>><br>
>><br>
>><br>
>> --<br>
>> Λ\ois<br>
>> <a href="http://twitter.com/aloiscochard" rel="noreferrer" target="_blank">http://twitter.com/aloiscochard</a><br>
>> <a href="http://github.com/aloiscochard" rel="noreferrer" target="_blank">http://github.com/aloiscochard</a><br>
>><br>
>> _______________________________________________<br>
>> Libraries mailing list<br>
>> <a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br>
>> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
><br>
><br>
><br>
><br>
> --<br>
> Λ\ois<br>
> <a href="http://twitter.com/aloiscochard" rel="noreferrer" target="_blank">http://twitter.com/aloiscochard</a><br>
> <a href="http://github.com/aloiscochard" rel="noreferrer" target="_blank">http://github.com/aloiscochard</a><br>
><br>
><br>
> _______________________________________________<br>
> Libraries mailing list<br>
> <a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br>
> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
><br>
_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr">Chris Allen<br><div><span style="font-size:12.8000001907349px">Currently working on </span><a href="http://haskellbook.com" target="_blank">http://haskellbook.com</a></div></div></div></div></div></div>
</div>
</div></blockquote></body></html>