summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2012-05-14 22:01:31 +1000
committerJed Barber <jjbarber@y7mail.com>2012-05-14 22:01:31 +1000
commitca22154af94bb260c812af4e11441b5a79790575 (patch)
tree09980455f23e29e98bdb70e2025160722ec14f44
parent111e4ab5200ee064b1132ef9e843b786441b5752 (diff)
Started using Data.Char for number testing
-rw-r--r--Syntactic.hs17
1 files changed, 2 insertions, 15 deletions
diff --git a/Syntactic.hs b/Syntactic.hs
index 168aa4e..45eedda 100644
--- a/Syntactic.hs
+++ b/Syntactic.hs
@@ -1,6 +1,7 @@
import Control.Monad( liftM )
import System( getArgs )
import Text.Printf
+import qualified Data.Char as Char
getLines :: FilePath -> IO [String]
@@ -19,21 +20,7 @@ isNumber :: String -> Bool
isNumber ('0':[]) = True
isNumber ('-':ns)
| (ns /= [] && head ns /= '0') = isNumber ns
-isNumber n = all (isDigit) n
-
-
-isDigit :: Char -> Bool
-isDigit '0' = True
-isDigit '1' = True
-isDigit '2' = True
-isDigit '3' = True
-isDigit '4' = True
-isDigit '5' = True
-isDigit '6' = True
-isDigit '7' = True
-isDigit '8' = True
-isDigit '9' = True
-isDigit _ = False
+isNumber n = all (Char.isNumber) n
isName :: String -> Bool