title: Type mismatch; found : Int(1) required: B
body: <p>I'm trying to extend the <code>List</code> class to give it some more streamlined way to compare the sizes, however I run into the error in the title...</p>
  
  <p>Here's my code: </p>
  
  <pre><code>implicit class RichList[A, B](input: List[A]) {
    def &gt;(that: List[B]): Boolean = input.size &gt; that.size
    def &lt;(that: List[B]): Boolean = input.size &lt; that.size
  }
  </code></pre>
  
  <p>The idea was that since all it does it compare the sizes of the lists, their types could be different and it wouldn't matter, however when I try to do this:</p>
  
  <pre><code>val test = List(1,2,3,4) &lt; List(1,2,3,4,5)
  </code></pre>
  
  <p>I get the beforementioned error. If I remove B and set <code>that</code> to be of type <code>List[A]</code> it works fine, but then I wouldn't be able to use lists containing 2 different types...</p>
  
  <p>Why is it that both A and B can't be the same type? Or am I missing something?</p>
  
  <p><strong>Edit:</strong> Ok I've found a solution to the error, which is rather simple: </p>
  
  <pre><code>implicit class RichList[A](input: List[A]) {
    def &gt;[B](that: List[B]): Boolean = input.size &gt; that.size
    def &lt;[B](that: List[B]): Boolean = input.size &lt; that.size
  }
  </code></pre>
  
  <p>However my question still stands; why can't I do it the other way?</p>