title: How can I solve the Diverging implicit expansion for type
body: <p>I want to make my case class <code>Event[K, V]</code> be ordered by key <code>K</code> always. But I need to be able to compare Events of different values <code>V</code>. How can I solve this diverging implicit expansion?</p>
  
  <pre><code>import scala.math.Ordering
  
  object Event {
    case class Event[K, V](key: K, value: V)
      (implicit o: Ordering[K]) extends Ordered[Event[K, _]] {
        override def compare(that: Event[K, _]): Int = o.compare(key, that.key)
      }
  }
  
  object Main extends App {
    // mimicking a librarys function 
    def lala[O](e: O)(implicit ordering: Ordering[O]) = ???
  
    val b = Event.Event("a", 12) &lt;= Event.Event("a", 11.99)    
    lala(Event.Event("a", 12))
  }
  </code></pre>
  
  <p>The call to <code>lala</code> does not compile because of this diverging implicit expansion:</p>
  
  <pre><code>diverging implicit expansion for type   
  scala.math.Ordering[Event.Event[String,Int]] starting with method $conforms 
  in object Predef lala(Event.Event("a", 12))
  </code></pre>