title: scala: implement a generic recursive max function
body: <p>I'm trying to port this haskell max function implementation to scala</p>
  
  <pre><code>maximum' :: (Ord a) =&gt; [a] -&gt; a  
  maximum' [] = error "maximum of empty list"  
  maximum' [x] = x  
  maximum' (x:xs) = max x (maximum' xs) 
  </code></pre>
  
  <p>This is my first attempt:</p>
  
  <pre><code>def max[T &lt;: Ordered[T]](list: List[T]): T = list match {
  
    case Nil =&gt; throw new Error("maximum of empty list")
    case head :: Nil =&gt; head
    case list =&gt; {
      val maxTail = max(list.tail)
      if (list.head &gt; maxTail) list.head else maxTail
    }
  }
  
  
  max(List[Int](3,4))
  </code></pre>
  
  <p>But I get the following error:</p>
  
  <pre><code>inferred type arguments [Int] do not conform to method max's type parameter bounds [T &lt;: Ordered[T]]
  </code></pre>
  
  <p>I tried with ordering, comprable, etc with similar results... </p>
  
  <p>Any idea about what's missing?</p>