twitter/scala_school — pull request #42 by lahosken (2012-08-20 21:36:10+00:00)
Title: Divvy big examples into smaller ones. Use type names that suggest inherit

These changes would have made it easier for me to learn about Scala[Type] magic. I dunno if they make other stuff worse. E.g., maybe they make it tougher to use this material as class slides or whatever.

I had a hard time figuring out why
def foo[A, B](f: A => List[A], b: B, c: Int) = (f(b), f(c))
doesn't compile. So I tried dividing this up into two simpler
examples to introduce the ideas one at a time.

Similarly, presenting me with a list of examples like
val f: (B => C) = ((b: B) => new C)
some of which show covariance and some of which show contravariance,
but without any explanation pointing out which are which... that
filled up my brain. So I tried dividing this up into separate sections,
one showing co- and one showing contra-variance.

I claim that C extends B extends A followed by E extends F is hard to keep
in my^W one's head. Instead use Chicken extends Bird extends Animal which
isn't abstract, but I don't have to go back to remember whether things inherit
in alpha order or reverse alpha order.