From 6b9b4e90e4f3bea26834d641899621ad02285b14 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Fri, 11 May 2012 14:33:48 +1000 Subject: isNumber and isName slightly more readable --- Syntactic.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Syntactic.hs b/Syntactic.hs index 0abff0f..168aa4e 100644 --- a/Syntactic.hs +++ b/Syntactic.hs @@ -18,8 +18,8 @@ isComment = (==) '#' . head isNumber :: String -> Bool isNumber ('0':[]) = True isNumber ('-':ns) - | ns /= [] && head ns /= '0' = isNumber ns -isNumber n = null . filter (not . isDigit) $ n + | (ns /= [] && head ns /= '0') = isNumber ns +isNumber n = all (isDigit) n isDigit :: Char -> Bool @@ -37,7 +37,7 @@ isDigit _ = False isName :: String -> Bool -isName s = foldr (&&) True $ map ((==) '"') $ [head s, last s] +isName s = all ((==) '"') [head s, last s] scan :: String -> String -- cgit