Why is Scala’s immutable Set not covariant in its type?
Set is invariant in its type parameter because of the concept behind sets as functions. The following signatures should clarify things slightly: trait Set[A] extends (A=>Boolean) { def apply(e: A): Boolean } If Set were covariant in A, the apply method would be unable to take a parameter of type A due to the contravariance … Read more