docs.scala-lang icon indicating copy to clipboard operation
docs.scala-lang copied to clipboard

Variance rewrite

Open martijnhoekstra opened this issue 3 years ago • 0 comments

All but a full rewrite. I have always found this section of the tour confusing at least, particularly the part where it does the function.

In my experience, most people start with the false intuition that things should automatically be invariant. That's why I start with invariance, show why things can't be covariant by default. Then I show covariance, and then I show contravariance as the opposite.

I completely omit the profunctor thing with co and contravariance at the same time: I don't think it helps understanding of variance.

It's written a bit more tutorial style than most of the tour, because this tend to be a point where many questions arise, and readers can use a gentle push on understanong.

martijnhoekstra avatar Aug 08 '22 10:08 martijnhoekstra