<div dir="ltr"><div>I'm a newbie, knowing a little about Haskell, and hope my question isn't very silly...<br></div><div>=====================================================================</div><div>My absolute value function looks like this:<br></div><div><br></div><div>abs2 :: Num a => a -> a</div><div>abs2 n = if n >= 0 then n else 0 - n</div><div><br></div><div>GHCi tells me that I should add Ord type class to its definition. Well, it's true. It has used relational operators and Num isn't a subclass of Ord.</div><div>However, when I input ":t abs" in GHCi, the interpreter shows "abs :: Num a => a -> a". I read GHC/Num.lhs and find that abs is defined as "abs :: a -> a" and has no concrete content. So I think the abs function is written in C as a module to implement directly and the type of abs just follows its class GHC.Num. Is it right? Or there are any other reasons? </div><div><br></div><div>Thanks,</div><div><br></div><div>Hengruo<br></div></div>