diff options
author | Jed Barber <jjbarber@y7mail.com> | 2012-05-11 14:33:48 +1000 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2012-05-11 14:33:48 +1000 |
commit | 6b9b4e90e4f3bea26834d641899621ad02285b14 (patch) | |
tree | 752bddbf852c57d208f702d67366c19f5d4852de | |
parent | 26dc9aa2ecda3b8847908a14b7777cc6d561caaf (diff) |
isNumber and isName slightly more readable
-rw-r--r-- | Syntactic.hs | 6 |
1 files 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 |