Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Covariance and Contravariance in Scala (atlassian.com)
3 points by stefans on Jan 16, 2013 | hide | past | favorite | 1 comment


Every 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).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: