Add an example of covariance and contravariance together in one type.

Sometimes covariance and contravariance are mixed in the same type. A
prominent example is Scala’s function traits. For instance, whenever you
write the function type A => B, Scala expands this to Function1[A, B].

The definition of Function1 in the standard library uses both covariance
and contravariance: the Function1 trait is contravariant in the function
argument type S and covariant in the result type T, as shown here.

It is safe to assume that a type T is a subtype of a type U if you can
substitute a value of type T wherever a value of type U is required.

This is called the Liskov Substitution Principle. The principle holds if
T supports the same operations as U and all of T’s operations require
less and provide more than the corresponding operations in U.

Function1 satisfies the Liskov substitution principle, because arguments
are something that’s required, whereas results are something that’s
provided.

So it follows, that a Function1 of S, T is able to accept an S or any
supertype in its apply method, and it is able to return a T
or any subtype.