<div dir="ltr">On Tue, Jul 23, 2013 at 10:33 AM, Louis-Guillaume Gagnon <span dir="ltr"><<a href="mailto:louis.guillaume.gagnon@gmail.com" target="_blank">louis.guillaume.gagnon@gmail.com</a>></span> wrote:<div class="gmail_extra">
<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
isPalindrome xs<br>
| odd (length xs) = False<br>
| firstHalf == secondHalf =True<br>
| otherwise = False<br>
where half = div (length xs) 2<br>
firstHalf = take half xs<br>
secondHalf = reverse (drop half xs)<br>
<br>
I would expect the type signature to be:<br>
isPalindrome :: [a] -> Bool<br>
<br>
but ghci gives me<br>
is Eq a => [a] -> Bool<br>
<br>
and I don't undestand why the "Eq a =>" shows up<br></blockquote><div><br></div><div>"Eq a" is the "Type class" of "a". It means that "a" is a type that supports the checking of equality.</div>
<div><br></div><div>Other type classes include: "Show" (types that are printable), and "Ord" (types that are orderable).</div><div><br></div><div>Cheers,</div><div><br></div><div>MCL</div></div></div>
</div>