tidy: Logic.Parse
This commit is contained in:
parent
88c140fed5
commit
bd9b58c405
1 changed files with 4 additions and 4 deletions
|
@ -79,9 +79,9 @@ parseToken token = Parser parse
|
||||||
| otherwise = Left $ expected (show token) input
|
| otherwise = Left $ expected (show token) input
|
||||||
|
|
||||||
parseIf :: Show s => String -> (s -> Bool) -> Parser s s
|
parseIf :: Show s => String -> (s -> Bool) -> Parser s s
|
||||||
parseIf description check = Parser $ \input ->
|
parseIf description check = Parser $ \input@(Input pos xs) ->
|
||||||
case inputSeq input of
|
case xs of
|
||||||
[] -> Left $ ParseError (inputPos input) "unexpected end of input"
|
[] -> Left $ ParseError pos "unexpected end of input"
|
||||||
(char:chars)
|
(char:chars)
|
||||||
| check char -> Right $ (char,) $ Input (inputPos input + 1) chars
|
| check char -> Right $ (char,) $ Input (pos + 1) chars
|
||||||
| otherwise -> Left $ expected description input
|
| otherwise -> Left $ expected description input
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue