Created
May 3, 2022 09:21
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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