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
|
||||
|
||||
parseIf :: Show s => String -> (s -> Bool) -> Parser s s
|
||||
parseIf description check = Parser $ \input ->
|
||||
case inputSeq input of
|
||||
[] -> Left $ ParseError (inputPos input) "unexpected end of input"
|
||||
parseIf description check = Parser $ \input@(Input pos xs) ->
|
||||
case xs of
|
||||
[] -> Left $ ParseError pos "unexpected end of input"
|
||||
(char:chars)
|
||||
| check char -> Right $ (char,) $ Input (inputPos input + 1) chars
|
||||
| check char -> Right $ (char,) $ Input (pos + 1) chars
|
||||
| otherwise -> Left $ expected description input
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue