generalize type of Data.Set.unions from List to Foldable

David Feuer david.feuer at
Sun Feb 4 01:44:44 UTC 2018

It is fold, although fold is not so great for lists in this context. It's
also foldl' union Set.empty, which is better for lists, and probably also
for balanced trees. I initially thought that we should surely generalize,
but now another alternative comes to mind: remove. As a containers
maintainer, I believe we should either:

1. Generalize as proposed, or
2. Deprecate and remove.

I'm currently somewhat in favor of the second option.

On Feb 3, 2018 9:42 AM, "Henning Thielemann" <lemming at>

On Sat, 3 Feb 2018, Johannes Waldmann wrote:

I propose this change for containers:
> have:  unions ::               [ Set a ] -> Set a
> want:  unions :: Foldable f => f (Set a) -> Set a

That's Foldable.fold.

Libraries mailing list
Libraries at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Libraries mailing list