title: scala: how to create a generic type which is subtype of all the number classes in scala so that it can include compare method
body: <p>I am trying to create a generic class with generic type being subclass of Numeric (to ensure that I am dealing with numbers.)
  and I tried "<code>class NuVector[T&lt;:Numeric[T])</code>" as class def and it compiling fine.</p>
  
  <p>Now I want to add <code>PartiallyOrdered[T]</code> to it. so I did the following:</p>
  
  <pre><code>class NuVector[T&lt;:Numeric[T]) extends PartiallyOrdered[T]
  {
  
   /** Array that stores the vector values.
       */
      val v = new Array [T] (_length)
      /** Range for the storage array.
       */
      private val range = 0 to _length - 1
  
      def compare(x:T,y:T)(implicit res:Numeric[T]) :Int=
      { 
         res.compare(x,y) 
      } 
  
     def tryCompareTo [B &gt;: NuVector [T]] (b: B)
          (implicit view$1: (B) =&gt; PartiallyOrdered [B]): Option [Int] =
      { 
          compare(x,y) 
      } 
  
      implicit def castT2Ordering(x:T):Numeric[T]=x.asInstanceOf[Numeric[T]]
      implicit def castB2NuVector [B&gt;:NuVector[T]] (b:B): NuVector[T]=
      {
                b.asInstanceOf[NuVector[T]]
      }
  
  }
  </code></pre>
  
  <p>it is not compiling. 
  The error I am getting while compiling is:</p>
  
  <pre><code> could not find implicit value for parameter res:Numeric[T] 
  </code></pre>
  
  <p>Scala version I am using is 2.8 </p>
  
  <p>Any help is greatly appreciated. </p>
  
  <p>Thanks,<br>
  ~Tiger.<br>
  I don't know whether it is a bug or its a problem with my definition. </p>