Expand the Data.Set API

Ben Millwood haskell at benmachine.co.uk
Sat Mar 7 14:43:34 UTC 2015


On Thu, Mar 05, 2015 at 05:59:23PM -0500, David Feuer wrote:
>1. A way to take the intersection of a list of sets. This shouldn't
>really be a big deal, and it already exists for unions, but the
>intersection version should probably sort the sets by size before
>folding, or otherwise try to do something smart.

I would guess the major reason intersection is more awkward than union 
is that the intersection of the empty list is not defined (there's no 
identity for the intersection operation), whereas for unions that 
problem doesn't exist.

I don't think that's a dealbreaker -- foldr1 exists, after all -- but it 
does open a discussion about whether we want to error on the empty list 
or force the user to provide a first element or something.


More information about the Libraries mailing list