
Hi, I'm following the Real World Haskell book and in chapter three came across the exercise to sort a list of lists. I attach what i have so far. My question is the following. Why do i need to add "Eq a =>" to the type definition of sortListOfLists? The type of a should be irrelevant as i see it, my function couldn't care less what the type of the contents of the lists in the list are, or? All my function cares about is the length of those lists in the list. The designator a in the type declaration for sortListOfLists denote the type of the contents in the lists of lists as i understand it. So a list of lists containing object i can test for equality. Another thought i have is if i really have to specify that i expect list of lists. Couldn't that be list of something else with a length, a string perhaps, just as well? In other words a type like sortListOfLists :: a -> a. As i see it that should be just as valid as the type of what i return is the same as that which i get as input regardless of it being a list or not. -- Patrik Iselind