
On Thu, Feb 25, 2016 at 4:47 AM, Thomas Tuegel
Foldable implies a notion of structural direction through the associativity of its members. Set is different from the well-behaved Foldables because its notion of direction or order is not structural, i.e. not preserved by operations on Set.
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. 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. Kris