Is there a concise way to "invert" an Option? : <p>Say I have a function that can take an optional parameter, and I want to return a <code>Some</code> if the argument is <code>None</code> and a <code>None</code> if the argument is <code>Some</code>:</p>

<pre><code>def foo(a: Option[A]): Option[B] = a match {
  case Some(_) =&gt; None
  case None    =&gt; Some(makeB())
}
</code></pre>

<p>So what I want to do is kind of the inverse of <code>map</code>. The variants of <code>orElse</code> are not applicable, because they retain the value of <code>a</code> if it's present.</p>

<p>Is there a more concise way to do this than <code>if (a.isDefined) None else Some(makeB())</code>?</p>
