title: Combining two EitherT, return first if it succeeds else return second
body: <p>Consider the following snippet:</p>
  
  <pre><code>def foo(x:String): EitherT[F, Throwable, String] = ???
  def bar(x:String): EitherT[F, Throwable, String] = ???
  </code></pre>
  
  <p>I want the following: </p>
  
  <p>On some input <code>s</code>, first call <code>foo(s)</code> and if it "fails" return the output of <code>bar(s)</code> else return the output of <code>foo(s)</code> without calling <code>bar(s)</code>. I have come up with the following. </p>
  
  <pre><code>def foobar(s:String) = {
    val f = foo(s)
    // if f is successful return f else return bar(s)
    f.biflatMap(_ =&gt; bar(s), _ =&gt; f)
  }
  </code></pre>
  
  <p>Is there a better way to do what I want? </p>