I am trying to write a function that returns the absolute value of an integer ...
abs :: Int -> Int abs n | n >= 0 = n | otherwise = -n myabs :: Int -> Int myabs n = if n >= 0 then n else -n
Both of them work for positive integers, but not for negative integers. Any idea why?
haskell
user147056
source share