<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2017-04-09 2:01 GMT+02:00 Ben Franksen <span dir="ltr"><<a href="mailto:ben.franksen@online.de" target="_blank">ben.franksen@online.de</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Am 08.04.2017 um 04:03 schrieb Anthony Clayden:<br>> [...] So to take your examples from an earlier thread,<br>
> what do you expect Haskell to do here?:<br>
><br>
>    maximum (True,2)   =>   ?<br>
>    minimum ((3, 4),5)   => ?   -- i.e. :: ((Int, Int), Int)<br>
>    sum (7,3.14)   =>   ?     -- i.e. :: (Int, Double)<br>
>    product (Left $ error "Errk")   =>   ?   -- i.e. ::<br>
> Either e Int<br>
<br>
</span>I (and others) think these should be type errors.<br></blockquote><div><br></div><div>Exactly.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class=""><br>
> Do you expect Foldable (a, a) to behave differently<br>
> vs Foldable (b, a) vs Foldable ((a, a), a) vs ...?<br>
><br>
> Let's get everybody agreed on that.<br>
<br>
</span>It would be nice if we could all agree on removing these instances.<br></blockquote><div><br></div><div>Yep. :-) </div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
BTW, I find it remarkable that of those who defend these instances, few<br>
seem to be especially interested in clarifying the OP's question: what<br>
laws exactly do we expect for Foldable? [...]<br></blockquote><div><br></div><div>And even if there are laws which hold for those instances, it doesn't mean that these instances should be defined. Take e.g. Bool: One can define a "Num Bool" instance which respects the usual laws (interpreting Bool basically as a "Word1", just like Word32 etc.), but we do *not* want to have this in the standard language/libraries, and for a good reason: It would make types less useful, removing a part of the usual "If it compiles, it works" safety net...</div></div></div></div>