SortedSet Collector #3612
Closed
benhutchison
started this conversation in
Ideas
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 |
0 replies
|
Thanks Michael 🙂 |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
All reactions