isPalindrome :: [a] -> Bool
isPalindrome xs = case xs of
[] -> True
[x] -> True
a -> (last a) == (head a) && (isPalindrome (drop 1 (take (length a - 1) a)))
main = do
print (show (isPalindrome "blaho"))
приводит к
No instance for (Eq a)
arising from a use of `=='
In the first argument of `(&&)', namely `(last a) == (head a)'
In the expression:
(last a) == (head a)
&& (isPalindrome (drop 1 (take (length a - 1) a)))
In a case alternative:
a -> (last a) == (head a)
&& (isPalindrome (drop 1 (take (length a - 1) a)))
Зачем возникает эта ошибка?