[Haskell-cafe] is there something special about the Num instance?

Anatoly Yakovenko aeyakovenko at gmail.com
Wed Dec 3 18:05:37 EST 2008


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"


More information about the Haskell-Cafe mailing list