4 ms·
Covariance and Contravariance in Scala
- lmm 14y agoEvery time I've seen someone mention category theory, it's to use it to overcomplicate something very simple. class Holder[+A] is a declaration that Holder[S] is a subtype of Holder[T] whenever S is a subtype of T. If you keep that in mind it's obvious why you're getting a compile error. (To be fair, the article does explain this pretty well by the end - it's just got a lot of excessive complication in the middle).