Num
requires instances to implement +
, *
, abs
, signum
, and fromInteger
. Note that ==
isn't on the list! It's instances of the Eq
typeclass that must implement ==
.
So, the Num
constraint is not sufficient - you need an Eq
constraint too. The following will compile.
checkIsZero :: (Eq a, Num a) => a -> String
checkIsZero a | a == 0 = "Zero"
| otherwise = "Not zero"
Integral
works because something which is an instance of Integral
must itself be an instance of Ord
, which in turn must be an instance of Eq
.
You can check all this stuff by using hoogle and digging into the source.