You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While rollback allows the user to roll state back within a local computation if it failed, it only works if the parser in question does not consume input. There is no way to tightly rollback the state from the branch except for further up the parser where the input is rolled back. This isn't a disaster but is somewhat annoying.
A combinator like onFail :: Parser a -> Parser () -> Parser a which unconditionally executes a pure parser on the failure of some other parser would allow users to perform stateful operations after a parser has failed. This wouldn't require any new instructions, but would require a new AST node to be introduced.
Using this it is possible to make local completely rollback local modifications with the local combinator
The text was updated successfully, but these errors were encountered:
While
rollback
allows the user to roll state back within a local computation if it failed, it only works if the parser in question does not consume input. There is no way to tightly rollback the state from the branch except for further up the parser where the input is rolled back. This isn't a disaster but is somewhat annoying.A combinator like
onFail :: Parser a -> Parser () -> Parser a
which unconditionally executes a pure parser on the failure of some other parser would allow users to perform stateful operations after a parser has failed. This wouldn't require any new instructions, but would require a new AST node to be introduced.Using this it is possible to make local completely rollback local modifications with the
local
combinatorThe text was updated successfully, but these errors were encountered: