Skip to content

Commit edc61eb

Browse files
Make <?> infixr and update prec to 2 (#163)
* Make <?> infixr and update prec to 2 * Add changelog entry
1 parent 6d9e3ed commit edc61eb

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ Notable changes to this project are documented in this file. The format is based
77
Breaking changes:
88
- Update project and deps to PureScript v0.15.0 (#160 by @JordanMartinez)
99
- Drop deprecated `MonadZero` instance (#160 by @JordanMartinez)
10+
- Make `<?>` right-associative and increase prec from 3 to 2 (#163 by @JordanMartinez)
11+
12+
`<|>` was made right associative. `<?>` was likewise changed to prevent a
13+
possible error and its precedence was increased so that `foo <|> bar <?> "err msg"`
14+
works without parenthesis around `"err msg"` part.
1015

1116
New features:
1217

src/Text/Parsing/Parser/Combinators.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ import Text.Parsing.Parser (ParseError(..), ParseState(..), ParserT(..), fail)
119119
withErrorMessage :: forall m s a. Monad m => ParserT s m a -> String -> ParserT s m a
120120
withErrorMessage p msg = p <|> fail ("Expected " <> msg)
121121

122-
infixl 3 withErrorMessage as <?>
122+
infixr 2 withErrorMessage as <?>
123123

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

0 commit comments

Comments
 (0)