How to get free YouTube subscribers, likes and views?
Get Free YouTube Subscribers, Views and Likes

Variance Positions in Scala Demystified | Rock the JVM

Follow
Rock the JVM

Written version: https://blog.rockthejvm.com/scalatyp...

Links from the video:
Why is contravariance so hard    • Contravariance in Scala: Why Is It So...  

The advanced Scala course that discusses lots of these type system issues including variance: https://rockthejvm.com/p/advancedscala'>https://rockthejvm.com/p/advancedscala

This video is for the mature Scala developer. We talk about variance in Scala as an innocent question: if A extends B, should Thing[A] be a subtype of Thing[B]?

We then show the variance possibilities in Scala, and we explore the kind of problems this can pose. The infamous and cryptic "covariant type T occurs in contravariant position" will come up and we'll prove why that is the case.

Finally, we'll solve the "covariant type in contravariant position" problem with some generic type magic.

Follow Rock the JVM on:
LinkedIn:   / rockthejvm  
Twitter:   / rockthejvm  
Blog: https://rockthejvm.com/blog'>https://rockthejvm.com/blog


Home: https://rockthejvm.com

posted by mahashumu82