<div dir="ltr">On Thu, Mar 2, 2017 at 1:12 PM, Kris Nuttycombe <span dir="ltr"><<a href="mailto:kris.nuttycombe@gmail.com" target="_blank">kris.nuttycombe@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">As with all of these discussions, the point of having Either be Foldable is not that you're going to call foldMap on an Either value directly. Instead, it is that you be able to pass whatever sort of foldable thing you choose (which Either certainly is) to a function that only requires foldability of its input. By removing or damaging the Foldable instance for Either, you don't simply prevent people from encountering problems that will be resolved the first time they test their software - you make a whole universe of nicely polymorphic functions unavailable for them to use without additional effort.</div></blockquote><div><br></div><div>Not just polymorphic functions. Many higher-order type constructors have Foldable instances based on their parameters. For example,</div><div><br></div><div><div>data Cofree f a = a :< f (Cofree f a)</div><div><br></div><div>instance Foldable f => Foldable (Cofree f a) where</div><div><span class="m_-8420925741519727205gmail-Apple-tab-span" style="white-space:pre-wrap">  </span>foldMap f (a :< as) = f a <> foldMap (foldMap f) as</div></div><div><br></div><div>Without the instance for Either b, we lose the instances for Cofree (Either b) and Cofree (Compose [] (Either b)), both of which seem reasonable and useful.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>In particular, the idea that one should make all such functions partial by throwing an error is repugnant.<br></div></div></blockquote><div><br></div><div>Yes, that seems like the worst possible solution. Better would be some way to give a warning when calling an overloaded function at a particular type.</div></div><div><br></div>-- <br><div class="m_-8420925741519727205gmail_signature">Dave Menendez <<a href="mailto:dave@zednenem.com" target="_blank">dave@zednenem.com</a>><br><<a href="http://www.eyrie.org/~zednenem/" target="_blank">http://www.eyrie.org/~<wbr>zednenem/</a>></div>
</div></div>