Skip to content

Instantly share code, notes, and snippets.

@SuperCipher
Created May 3, 2022 09:21
Show Gist options
  • Save SuperCipher/e82a4464cd14835247a0ef295c4250b3 to your computer and use it in GitHub Desktop.
Save SuperCipher/e82a4464cd14835247a0ef295c4250b3 to your computer and use it in GitHub Desktop.
function to create a set of non zero interger number useful for sanitize input
toNonZeroInteger :: Int -> Int
toNonZeroInteger 0 = 1
toNonZeroInteger x = if x < 0
then (-x) + 1
else x + 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment