<div dir="auto">I'm not concerned about the maintenance cost. I'm more concerned about the size of the API. People tend to get lost in the sea of functions in containers. But it sounds like lots of people are attached to unions, so what do y'all think about generalizing its type?</div><div class="gmail_extra"><br><div class="gmail_quote">On Feb 5, 2018 9:52 AM, "Oliver Charles" <<a href="mailto:ollie@ocharles.org.uk">ollie@ocharles.org.uk</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">unions also describes intent clearly. My intention is to take the union of a collection of sets. That might well correspond with a fold, but that's an implementation detail - and not one that I particularly care about. On top of that, when people read my code, I want them to understand that I intend to take the unions of a collection of sets, rather than having them figure out what it is I'm doing by using foldl.<div><br></div><div>I don't really see the harm in keeping unions, and I don't see the advantage in removing it. If we're arguing that unions is so simple to write, then the argument that deleting code will improve maintainability doesn't hold - because apparently it's so simple we're not going to introduce bugs in containers. If you don't agree with that reasoning, then apparently unions is sufficiently complicated to write that it <i>should</i> be in the containers library.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 5, 2018 at 2:46 PM, Jan-Willem Maessen <span dir="ltr"><<a href="mailto:jmaessen@alum.mit.edu" target="_blank">jmaessen@alum.mit.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">The biggest argument in favor of unions and unionsWith is that, while they're easy to write, they're also very easy to write wrong – for example by using fold instead of foldl' as described rather well in the conversation so far. When I use a function like unions I expect to get an implementation better than the one I'd come up with on my own at the spur of the moment, and deciding what strictness is more efficient in this case is actually a little bit subtle.<span class="m_-5507449351660787643HOEnZb"><font color="#888888"><div><br></div><div>-Jan-Willem Maessen</div></font></span></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="m_-5507449351660787643h5">On Sun, Feb 4, 2018 at 3:09 PM, Joachim Breitner <span dir="ltr"><<a href="mailto:mail@joachim-breitner.de" target="_blank">mail@joachim-breitner.de</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_-5507449351660787643h5">Hi,<br>
<span><br>
Am Samstag, den 03.02.2018, 20:44 -0500 schrieb David Feuer:<br>
> 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:<br>
><br>
> 1. Generalize as proposed, or<br>
> 2. Deprecate and remove.<br>
><br>
> I'm currently somewhat in favor of the second option.<br>
<br>
</span>please don’t remove!<br>
<br>
…is first reaction. Now I just have to rationalize my gut feeling…<br>
<br>
I like the readability of it in code, it is more descriptive. It is an<br>
important analogue to unionsWith. If we remove unions because of fold,<br>
shouldn’t we also remove union because of (<>)?<br>
<br>
<br>
Cheers,<br>
Joachim<br>
<span class="m_-5507449351660787643m_-8972263402051385989HOEnZb"><font color="#888888"><br>
--<br>
Joachim Breitner<br>
<a href="mailto:mail@joachim-breitner.de" target="_blank">mail@joachim-breitner.de</a><br>
<a href="http://www.joachim-breitner.de/" rel="noreferrer" target="_blank">http://www.joachim-breitner.de<wbr>/</a><br>
</font></span><br></div></div><span>______________________________<wbr>_________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bi<wbr>n/mailman/listinfo/libraries</a><br>
<br></span></blockquote></div><br></div>
<br>______________________________<wbr>_________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bi<wbr>n/mailman/listinfo/libraries</a><br>
<br></blockquote></div><br></div>
<br>______________________________<wbr>_________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/libraries</a><br>
<br></blockquote></div></div>