title: Why do I get an Could not deduce (Ord a) error?
body: <p>I am trying to find the  list with the smallest sum of elements.:</p>
  
  <pre><code>shortest :: (Num a) =&gt; [[a]] -&gt; [a]
  shortest [] = []
  shortest (x:xs) = if sum x &lt; sum (shortest xs) then x else shortest xs
  </code></pre>
  
  <p>That gives me the following error:</p>
  
  <blockquote>
  <pre><code>Could not deduce (Ord a) arising from a use of `&lt;'
  from the context (Eq a)
    bound by the type signature for shortest :: Eq a =&gt; [[a]] -&gt; [a]
    at code.hs:(8,1)-(9,71)
  Possible fix:
    add (Ord a) to the context of
      the type signature for shortest :: Eq a =&gt; [[a]] -&gt; [a]
  In the expression: sum x &lt; sum (shortest xs)
  In the expression:
    if sum x &lt; sum (shortest xs) then x else shortest xs
  In an equation for `shortest':
      shortest (x : xs)
        = if sum x &lt; sum (shortest xs) then x else shortest xs
  </code></pre>
  </blockquote>
  
  <p>Why doesn't the function typecheck?</p>