diff options
Diffstat (limited to 'src/Fun/Parser.hs')
-rw-r--r-- | src/Fun/Parser.hs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/Fun/Parser.hs b/src/Fun/Parser.hs index 0a16bc0..ff1e6bb 100644 --- a/src/Fun/Parser.hs +++ b/src/Fun/Parser.hs @@ -18,16 +18,16 @@ upperAlpha :: [Char] upperAlpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ" isDigit :: Char -> Bool -isDigit c = elem c "0123456789" +isDigit = (`elem` "0123456789") isAlpha :: Char -> Bool -isAlpha c = elem c $ lowerAlpha ++ upperAlpha +isAlpha = (`elem` lowerAlpha ++ upperAlpha) isLower :: Char -> Bool -isLower c = elem c lowerAlpha +isLower = (`elem` lowerAlpha) isUpper :: Char -> Bool -isUpper c = elem c upperAlpha +isUpper = (`elem` upperAlpha) ---- @@ -94,11 +94,10 @@ oneOrMore m = (iter m) <=> (/= "") <?> "one or more chars" iter :: Parser a -> Parser [a] iter m = m <+> iter m >>> (\(x, y) -> x : y) <|> result [] <?> "multiple" --- TODO: Improve this for better error reporting iterFull :: Parser a -> Parser [a] iterFull m = m <+> iterFull m >>> (\(x, y) -> x : y) <|> iterFull' iterFull' "" = Right ([], "") -iterFull' _ = Left $ State [StringTrace "<something>"] $ Nothing +iterFull' _ = Left $ State [] $ Nothing token :: Parser a -> Parser a token = (<+-> space) |