So I am doing some exercised in Haskell and I thought the type of int2nat
in
int2nat :: (Eq t, Num t) => t -> Nat
int2nat 0 = Zero
int2nat n = Succ (int2nat (n-1)
would be int2nat :: (Num t) => t -> Nat
.
Can somebody explain why this is not the case and why the additional Eq t
is correct instead?