Created
May 25, 2012 17:23
-
-
Save onlyshk/2789308 to your computer and use it in GitHub Desktop.
Is string number
This file contains 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
isInteger :: String -> Bool | |
isInteger s = case reads s :: [(Integer, String)] of | |
[(_, "")] -> True | |
_ -> False | |
-- | |
-- >> isInteger "3" | |
-- True | |
-- | |
-- >> isInteger "30s" | |
-- False | |
-- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment