title: Expression of type Right[Nothing, Map[String, String]] doesn't conform to expected type Left[String, Nothing]
body: <p>I have the following code, that does not compile: </p>
  
  <pre><code>object PcpProtocol {
  
    private type PcpKV = String
  
    private val findPublicKey: List[PcpKV] =&gt; Either[String, Map[String, String]] = kv =&gt;
      kv
        .filter(_.contains("PUBLIC:"))
        .foldLeft(Left("Can not find the public key from SAP.")) { (_, a) =&gt;
          a.split(":").toList match {
            case List(key, value) =&gt; Right(Map(key -&gt; value))
          }
  
        }
  } 
  </code></pre>
  
  <p>The compiler complains: </p>
  
  <pre><code>type mismatch;
  [error]  found   : scala.util.Right[Nothing,scala.collection.immutable.Map[String,String]]
  [error]  required: scala.util.Left[String,Nothing]
  [error]           case List(key, value) =&gt; Right(Map(key -&gt; value))  
  </code></pre>
  
  <p>What am I doing wrong?</p>