gpc
gpc copied to clipboard
Disambiguate precedence (biased 'or')
We should introduce a biased <<|>
operator which only backtracks if its left argument fails but otherwise commits to the first branch. This can be used to disambiguate precedence, e.g.
(+) <$> expr <* char '+' <*> expr
<<|> (*) <$> expr <* char '*' <*> expr