Skip to content

Make <?> infixr and update prec to 2 #163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ Notable changes to this project are documented in this file. The format is based
Breaking changes:
- Update project and deps to PureScript v0.15.0 (#160 by @JordanMartinez)
- Drop deprecated `MonadZero` instance (#160 by @JordanMartinez)
- Make `<?>` right-associative and increase prec from 3 to 2 (#163 by @JordanMartinez)

`<|>` was made right associative. `<?>` was likewise changed to prevent a
possible error and its precedence was increased so that `foo <|> bar <?> "err msg"`
works without parenthesis around `"err msg"` part.

New features:

Expand Down
2 changes: 1 addition & 1 deletion src/Text/Parsing/Parser/Combinators.purs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ import Text.Parsing.Parser (ParseError(..), ParseState(..), ParserT(..), fail)
withErrorMessage :: forall m s a. Monad m => ParserT s m a -> String -> ParserT s m a
withErrorMessage p msg = p <|> fail ("Expected " <> msg)

infixl 3 withErrorMessage as <?>
infixr 2 withErrorMessage as <?>

-- | Provide an error message in the case of failure, but lazily. This is handy
-- | in cases where constructing the error message is expensive, so it's
Expand Down