nullify 6 = 0 nullify 7.6 = 0 nullify [1,2,3] = [] nullify Tree = Empty etc.
I set up my class as follows:
class Null a where
nullify :: a -> a
instance Null Int where
nullify x = 0but get the following error when I invoke
nullify 6 on the Hugs command line:
ERROR - Unresolved overloading
*** Type : (Num a, Null a) => a
*** Expression : nullify 6
I then tried the following:
instance Num a => Null a where
nullify x = 0but got the following error in Hugs
ERROR "C:\zero.hs":5 - Syntax error in instance head (constructor expected)
Can anybody explain what I'm doing wrong ?
Thanks in advance,
Tim.
_______________________________________________ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe
