<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Feb 25, 2016 at 4:47 AM, Thomas Tuegel <span dir="ltr"><<a href="mailto:ttuegel@gmail.com" target="_blank">ttuegel@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class=""><br>
</span>Foldable implies a notion of structural direction through the associativity of<br>
its members. Set is different from the well-behaved Foldables because its notion<br>
of direction or order is not structural, i.e. not preserved by operations on<br>
Set.<br>
<span class=""><br></span></blockquote><div> </div>This is the first argument that I've seen in this whole messy thread that actually rings true for me - the fact that foldability is intricately tied to the ordering of elements is a very important one given that all that Monoid gives us is associativity and therefore any operation that we apply across a data structure that is *not* strictly ordered can have unpredictable results. Thank you very much for pointing this out. Converting from a Map or a Set to an ordered data structure before folding is obviously the principled thing to do - with Map in particular, the fact that the ordering of the keys is completely unrelated to the ordering of the values means that any non-commutative operation being applied across those values with foldMap is essentially a roll of the dice. This is troubling and something that should be corrected.<div><br></div><div>This brings me to a question that I've often had but never asked, which is, where are all the typeclasses for operations which demand commutativity? In particular, CommutativeApplicative is a typeclass that I've longed for; a peer to Monad that represents parallelizable rather than sequential effectful operations.</div><div><br></div><div>Kris</div></div></div></div>