Skip to content

Instantly share code, notes, and snippets.

@kaveet
Created November 29, 2016 16:04
Show Gist options
  • Save kaveet/2b095ee5e0a063e6a904abeca9d11de5 to your computer and use it in GitHub Desktop.
Save kaveet/2b095ee5e0a063e6a904abeca9d11de5 to your computer and use it in GitHub Desktop.
Haskell absolute value function for integers
module AbsoluteValue where
absoluteValue :: Int -> Int
absoluteValue n | n >= 0 = n
| otherwise = -n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment