Anatoly Yakovenko | 4 Dec 00:05
Picon
Gravatar

is there something special about the Num instance?

module Test where
--why does this work:
data Test = Test

class Foo t where
   foo :: Num v => t -> v -> IO ()

instance Foo Test where
   foo _ 1 = print $ "one"
   foo _ _ = print $ "not one"

--but this doesn't?

class Bar t where
   bar :: Foo v => t -> v -> IO ()

instance Bar Test where
   bar _ Test = print $ "test"
   bar _ _ = print $ "not test"

Gmane