
6 Aug
2011
6 Aug
'11
4:54 p.m.
(==) (Natural a) (Natural b) | a == b = True | otherwise = False
Essentially the same, but I usually write this a little shorter as (==) (Natural a) (Natural b) = a == b
(Natural a) * (Natural b) | a < 0 || b < 0 = Indeterminate | otherwise = Natural ((Prelude.*) a b)
Why this? A 'Natural x' should already guarantee that 'x' is not negative (otherwise it would be 'Indeterminate').
Thoughts?
It seems very reasonable to me. Regards, Thomas