title: How Implicit Ordering[Option[T]] works in scala?
body: <p>I'm playing a bit with implicit resolution, and wanted to understand what this implicit val useful for ? In Ordering we have</p>
  <pre><code>trait OptionOrdering[T] extends Ordering[Option[T]] {
      def optionOrdering: Ordering[T]
      def compare(x: Option[T], y: Option[T]) = (x, y) match {
        case (None, None)       =&gt; 0
        case (None, _)          =&gt; -1
        case (_, None)          =&gt; 1
        case (Some(x), Some(y)) =&gt; optionOrdering.compare(x, y)
      }
    }
    implicit def Option[T](implicit ord: Ordering[T]): Ordering[Option[T]] =
      new OptionOrdering[T] { val optionOrdering = ord }
  </code></pre>
  <p>I wonder when is implicit def Option[T](implicit ord: Ordering[T]): Ordering[Option[T]] useful or called.</p>
  <p>I tried the following:</p>
  <pre><code>def test[Option[T]: Ordering](value1: Option[T], value2: Option[T]) = {
    val e = implicitly(Ordering[Option[T]]).compare(value1, value2)
  }
  </code></pre>
  <p>But the compiler does not like it.</p>
  <p>not found: type T
  def test[Option[T]: Ordering](value1: Option[T], value2: Option[T]) = {</p>
  <p>and if i do which granted might not make sense but just for the sake</p>
  <pre><code>def test[Option[Int]: Ordering](value1: Option[Int], value2: Option[Int]) = {
    val e = implicitly(Ordering[Option[Int]]).compare(value1, value2)
  }
  
  I get 
  
  type Option takes type parameters
  def test[Option[Int]: Ordering](value1: Option[Int], value2: Option[Int]) = {
  No implicit Ordering defined for Option[Int]
  </code></pre>
  <p>Can someone give an example of how to use that implicit and or where is it useful and actually used ?</p>
  <p>My assumption is that when there is a need of an Ordering[Option[T]] then this function is called to resolve the implicit. But i am not able to make that happen ....</p>
  <p><strong>EDIT</strong>
  Well i wrote the following which make more sense</p>
  <pre><code>def test(value1: Option[Int], value2: Option[Int]) = {
    val e = implicitly(Ordering[Option[Int]]).compare(value1, value2)
  }
  </code></pre>
  <p>Then what i don't understand is the context Bound issue with</p>
  <pre><code>def test[Option[T]: Ordering](value1: Option[T], value2: Option[T]) = {
    val e = implicitly(Ordering[Option[T]]).compare(value1, value2)
  }
  
  What's wrong with writing a context bound like that ?
  </code></pre>