core: Add replaceError method
This commit is contained in:
parent
5e5ede87b4
commit
9b12ebcf00
1 changed files with 6 additions and 0 deletions
|
@ -69,6 +69,12 @@ guardMaybe message x = do
|
||||||
Just x <- x
|
Just x <- x
|
||||||
| _ => throwParseError message
|
| _ => throwParseError message
|
||||||
pure x
|
pure x
|
||||||
|
|
||||||
|
export
|
||||||
|
replaceError : (message : String) -> Parser (a -> Parser b)
|
||||||
|
replaceError message = do
|
||||||
|
state <- save
|
||||||
|
pure (\_ => throw $ MkParseError state message)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Running a parser
|
## Running a parser
|
||||||
|
|
Loading…
Add table
Reference in a new issue