KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
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")) results in 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))) Why is this error occurring?
Tags (comma-separated)
Save Edits
Cancel