Afaics, multiple passes of Enumerable:fold can also bubble sort and I suppose other sort algorithms. But that is not particularly germane to issue of this thread.
I can't visualize unambiguously what you mean. Perhaps a code example or explaining what in the current example you are referring to specifically?
Oh so you mean for example the type of R? But I propose a Comparable trait instead below.
So if the ValueType is a tagged union enum, does Rust know how to dynamic dispatch to the trait implementation for each possible data type in union? Edit: I see the answer is yes.
I assume yes, but afaics the problem remains that the enum is not first-class (so not extensible), so I can't change the ValueType when adding new values to the collection (unless I rebuild a copy of the collection on every add which is intolerable).
ValueType is a type parameter on the parameterized type I so afaics it is a HKT?
I'd prefer to see a Comparable trait here instead, but I don't know to specify that the associated type ValueType is bounded on the trait Comparable in Rust.
Afaics, the problem again is this is nominal and not first-class composability, thus afaics requires additional boilerplate.