title: Haskell: No instance for (Eq a) arising from a use of `=='
body: <pre><code>isPalindrome :: [a] -&gt; Bool
  isPalindrome xs = case xs of 
                          [] -&gt; True 
                          [x] -&gt; True
                          a -&gt; (last a) == (head a) &amp;&amp; (isPalindrome (drop 1 (take (length a - 1) a)))
  
  main = do
      print (show (isPalindrome "blaho"))
  </code></pre>
  
  <p>results in</p>
  
  <pre><code>No instance for (Eq a)
    arising from a use of `=='
  In the first argument of `(&amp;&amp;)', namely `(last a) == (head a)'
  In the expression:
    (last a) == (head a)
    &amp;&amp; (isPalindrome (drop 1 (take (length a - 1) a)))
  In a case alternative:
      a -&gt; (last a) == (head a)
           &amp;&amp; (isPalindrome (drop 1 (take (length a - 1) a)))
  </code></pre>
  
  <p>Why is  this error occurring?</p>