
The syntax is thus:
mysort :: (Ord a) => [a] -> [a]
On Thu, Jan 28, 2010 at 4:06 PM, george young
[complete newbie using ghci 6.10.4 I understand that I should indicate that 'a' is in class Ord, since I use lessthan. But what is the syntax? Other style suggestions are welcome.
mysort :: [a] -> [a] mysort [] = [] mysort [x] = [x] mysort [x, y] | (x <= y) = [x, y] | otherwise = [y, x] mysort l = (mysort s1) ++ (mysort s2) where (s1, s2) = splitAt (div (length l) 2) l
Could not deduce (Ord a) from the context () arising from a use of `<=' at /home/gry/foo.hs:53:17-22 Possible fix: add (Ord a) to the context of the type signature for `mysort' In the expression: (x <= y) In a stmt of a pattern guard for the definition of `mysort': (x <= y) In the definition of `mysort': mysort [x, y] | (x <= y) = [x, y] | otherwise = [y, x]
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners