title: Scala sorting Options
body: <p>If I have a case class like this</p>
  
  <pre><code>case class Foo(bar: Option[String])
  </code></pre>
  
  <p>why does this work</p>
  
  <pre><code>scala&gt; val l = List(Foo(Some("b")), Foo(Some("a")), Foo(Some("c")))
  l: List[Foo] = List(Foo(Some(b)), Foo(Some(a)), Foo(Some(c)))
  scala&gt; l.sortBy(_.bar)
  res1: List[Foo] = List(Foo(Some(a)), Foo(Some(b)), Foo(Some(c)))
  </code></pre>
  
  <p>but not this</p>
  
  <pre><code>scala&gt; l.sortWith((x,y) =&gt; x.bar &gt; y.bar)
  &lt;console&gt;:11: error: value &gt; is not a member of Option[String]
            l.sortWith((x,y) =&gt; x.bar &gt; y.bar)
  </code></pre>
  
  <p>If I want to sort a <code>List</code> of <code>Option[String]</code> in descending order, is it just simpler to use <code>sortBy</code> and then <code>reverse</code> the list?</p>