<div dir="auto">This has been raised before. I'm going to try to look at implementation within the next week or so.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Dec 1, 2020, 4:17 AM Ben Franksen <<a href="mailto:ben.franksen@online.de">ben.franksen@online.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Would it make sense to add a function like the following to containers:<br>
<br>
  symmetricDifference :: Set a -> Set a -> (Set a, Set a, Set a)<br>
  symmetricDifference a b = (a \\ b, a `intersection` b, b \\ a)<br>
<br>
with the idea that this can be implemented more efficiently as a<br>
primitive than the above specification? (And similarly for HashSet.)<br>
<br>
If this is the case, then perhaps difference and intersection could be<br>
defined in terms of this new primitive:<br>
<br>
  difference a b = let (r, _, _) = symmetricDifference in r<br>
  intersection a b = let (_, r, _) = symmetricDifference in r<br>
<br>
*if* it turns out that this does not degrade performance.<br>
<br>
Cheers<br>
Ben<br>
<br>
_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank" rel="noreferrer">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
</blockquote></div>