Discussion: Allow custom constraint for elem in Foldable

Edward Kmett ekmett at gmail.com
Fri Jul 28 04:19:01 UTC 2017


On Thu, Jul 27, 2017 at 6:45 PM, David Feuer <david.feuer at gmail.com> wrote:

> One might legitimately complain that such a wild type is ad hoc, but
> one might counter that complaint by saying that most of Foldable is
> already ad hoc.


My feelings largely echo Eric's in this regard.

Ultimately, the difference is that the rest of Foldable exists in a form
that can be standardized as part of Haskell' without requiring us to be
able to describe how type families, equality constraints, constraint kinds,
and default signatures work and also standardize them. The last one of
which being something that I'd say we really don't want in the language
standard as it causes all sorts of contortions about where you put code by
virtue of information flowing the wrong way, and all of which are highly
ghc specific.

Moreover, it interacts with non-trivial awkwardness with many of the more
complicated existing Foldable instances, e.g. Product, Sum, or really,
almost anybody else's Foldable instance that glues together more than one
'f' pretty much then has to override this member.

I'm pretty strongly -1 on changing `elem` in this manner.

-Edward
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20170728/963dbf2e/attachment.html>


More information about the Libraries mailing list