
On Tue, Jul 23, 2013 at 10:33 AM, Louis-Guillaume Gagnon < louis.guillaume.gagnon@gmail.com> wrote:
isPalindrome xs | odd (length xs) = False | firstHalf == secondHalf =True | otherwise = False where half = div (length xs) 2 firstHalf = take half xs secondHalf = reverse (drop half xs)
I would expect the type signature to be: isPalindrome :: [a] -> Bool
but ghci gives me is Eq a => [a] -> Bool
and I don't undestand why the "Eq a =>" shows up
"Eq a" is the "Type class" of "a". It means that "a" is a type that supports the checking of equality. Other type classes include: "Show" (types that are printable), and "Ord" (types that are orderable). Cheers, MCL