-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SortedSet.collect does not accept a function for which there is no Ordering on the codomain #11019
Comments
Hum, this is probably due to the absence of For 2.12 immutable.SortedSet(1).map(x => x)
// collection.immutable.SortedSet[Int] = TreeSet(1)
immutable.SortedSet(1).map(x => A(x))
// collection.immutable.Set[A] = Set(A(1)) 2.13
|
This is documented here: https://github.com/scala/collection-strawman/wiki/FAQ#what-are-the-breaking-changes. workarround: val temp: Set[Int] = collection.immutable.SortedSet(1).
temp.collect{ case x => A(x) } |
What should we do @MasseGuillaume? This is a documented change (and I would argue that the new behavior is a feature) and the recommended way to achieve what you want to achieve in the first post is to use the case class A(v: Int)
collection.immutable.SortedSet(1).unsorted.collect{ case x => A(x) }
// collection.immutable.Set[A] = Set(A(1)) |
|
2.12
2.13
The text was updated successfully, but these errors were encountered: