Novice question

Mark Carroll mark@chaos.x-philes.com
Sun, 22 Apr 2001 23:19:36 -0400 (EDT)


Is this a good place for novice questions? I have just started to try to
learn Haskell, and am using Hugs to start with. When I write the
not-very-useful function,

greaterthan 0 _ _ = False
greaterthan _ (x:xs) (y:ys) = x > y

and test it,

Main> greaterthan 2 [3] [4]
False
Main> greaterthan 3 [4] [3]
True
Main> greaterthan 0 [4] [3]
False
Main> greaterthan 0 [] []
ERROR: Unresolved overloading
*** Type       : Ord a => Bool
*** Expression : greaterthan 0 [] []

Main>

...I don't understand what the problem is. I'm guessing that the problem
is with the use of > and it not knowing which 'version' of > to use, but
it doesn't need to know because we're not matching with that line anyway.
I hope that didn't sound quite as confused as I am. (-:

Is there anything easy someone can say that will enlighten me as to why
things are as they are?

(I understand that Ord is a set of types and that you can probably only
 apply > to things that are in it, and that > is overloaded somehow.)

Thanks.

-- Mark