Variance of function
<pre><code>sealed trait Sum[+A, +B] {
  def flatMap[A, C](f: B =&gt; Sum[A, C]): Sum[A, C] =
    this match {
      case Failure(v) =&gt; Failure(v)
      case Success(v) =&gt; f(v)
    }
} 
</code></pre>

<p>Isn't it said that function parameters are contra-variant and the results co-variant? Why does the compiler say that A is in a contra-variant position? I am expecting compiler to complain that B is in a contra-variant position instead.</p>

<p>Can someone explain to me why this is so ? Feeling confused.</p>