From ca22154af94bb260c812af4e11441b5a79790575 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Mon, 14 May 2012 22:01:31 +1000 Subject: Started using Data.Char for number testing --- Syntactic.hs | 17 ++--------------- 1 file 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 -- cgit