
23 Jul
2013
23 Jul
'13
10:55 a.m.
but ghci gives me is Eq a => [a] -> Bool
and I don't undestand why the "Eq a =>" shows up.
You are doing the comparison firstHalf == secondHalf. Two lists are equal only if each element in the same position in the list are equal (and the lists are of equal length). Thus, you require that the elements of the list can be compared for equality. A type can be tested for equality only if it belongs to the Eq typeclass. Thus, automatic type inference in Haskell is putting this class constraint. Regards, Anindya