You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Ordering[T] trait and its friends Equiv[T] and PartialOrdering[T] should be contravariant in T. This would for example allow SeqLike.sorted to be declared as:
@vigdorchik said:
It's not possible to have Ordering contravariant until we drop the compatibility with java.util.Comparator, which is going to be a major change that needs good reason.
It's also not possible to declare an implicit view, since we don't control the implicit scope of Comparator.
The
Ordering[T]
trait and its friendsEquiv[T]
andPartialOrdering[T]
should be contravariant inT
. This would for example allowSeqLike.sorted
to be declared as:rather than
It would also provide a good didactic example of contravariance in the library!
The text was updated successfully, but these errors were encountered: