Scala check a Sequence of Eithers
<p>I want to update a sequence in Scala, I have this code :</p>

<pre><code>def update(userId: Long): Either[String, Int] = {
  Logins.findByUserId(userId) map {
    logins: Login =&gt; update(login.id,
      Seq(NamedParameter("random_date", "prefix-" + logins.randomDate)))
  } match {
    case sequence : Seq(Nil, Int) =&gt; sequence.foldLeft(Right(_) + Right(_))
    case _ =&gt; Left("error.logins.update")
  }
}
</code></pre>

<p>Where <code>findByUserId</code> returns a <code>Seq[Logins]</code> and <code>update</code> returns <code>Either[String, Int]</code> where <code>Int</code> is the number of updated rows, 
and <code>String</code> would be the description of the error.</p>

<p>What I want to achieve is to return an <code>String</code> if while updating the list an error happenes or an <code>Int</code> with the total number of updated rows.</p>

<p>The code is not working, I think I should do something different in the <code>match</code>, I don't know how I can check if every element in the <code>Seq</code> of <code>Either</code>s is a <code>Right</code> value.</p>