Hacker News new | ask | show | jobs
by ghostwriter 1221 days ago
A good example would be [1], where covariance and contra-variance are offered to you by the language due to its relation to OOP and the need for subtyping for it, whereas you'd probably be better off if you forgot about their existence (most of the times) and designed everything with Invariance and higher-kinded data [2].

[1] https://docs.scala-lang.org/tour/variances.html

[2] https://reasonablypolymorphic.com/blog/higher-kinded-data/