isPalindrome Eq Bool isPalindrome True isPalindrome True isPalindrome

1
2
3
4
5
6
isPalindrome :: Eq a => [a] -> Bool
isPalindrome [] = True
isPalindrome [_] = True
isPalindrome (x:xs)
| (x == last xs) = isPalindrome (init xs)
| _ = False