Deprecate Foldable for Either

Kris Nuttycombe kris.nuttycombe at gmail.com
Thu Mar 2 18:12:13 UTC 2017


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.

In particular, the idea that one should make all such functions partial by
throwing an error is repugnant.

Kris

On Thu, Mar 2, 2017 at 10:35 AM, Francesco Ariis <fa-ml at ariis.it> wrote:

> On Thu, Mar 02, 2017 at 05:19:26PM +0000, Oliver Charles wrote:
> > Personally, I think it would be a shame to lose foldMap on EIther. I
> > frequently foldMap over Maybe values (where mempty is suitable in case of
> > "failure"), and I can certainly see myself doing the same thing with
> Either.
>
> I am not trying to be polemic, just to see where the community
> stands: regarding Either/Maybe: do you have use cases for length
> (sum) too?
>
> _______________________________________________
> 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/20170302/5e1228e5/attachment.html>


More information about the Libraries mailing list