SortedSet Collector #3612
Replies: 3 comments
-
|
Thanks for calling this out. It was intended to work out of the box without the need for an explicitly defined collector. The expected derivation is something like this: given [A: Ordering] => Collector.Aux[A, collection.immutable.SortedSet[A]] =
Collector.supportsFactory(collection.immutable.SortedSet.evidenceIterableFactory[A])Would be great to figure out exactly why this isn't happening automatically and fix it for the general case. I'm guessing it's because |
Beta Was this translation helpful? Give feedback.
-
|
Fixed by #3613 |
Beta Was this translation helpful? Give feedback.
-
|
Thanks Michael 🙂 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Immutable SortedSets deserve more usage than they get IMHO. Often, I see List where people really ought to use a Set or a SortedSet.
One use case I've recently hit, not for the first time, is a predictable result ordering even when the generating process is nondeterministic, as many CE3 / FS2 processes can be. Predictable results are nice because it means we can assert on them in unit tests. I was seeing a unit test fail because the List of results contained the right elements, but in a varying order.
Truly what I wanted was SortedSet, not List, semantics. But there didnt seem to be a stream collector so I had to make one.
Beta Was this translation helpful? Give feedback.
All reactions