Skip to content

Conversation

@jacobpake
Copy link

@jacobpake jacobpake commented Nov 24, 2025

Parsers created with buildExprParser will try to chain prefix and postfix operators.

Previously, it was not possible to chain prefix operators, e.g. not not True, though this is was the behaviour for infix operators.

Consumers of this library may rely on the old behaviour.

Currently, this PR is a breaking change.

It should be considered if chaining/non-chaining is configurable on a per-operator basis (similar to how associativity is configurable for infix operators).

Another option is to add new constructor(s) to Operator, e.g. PrefixChained, PostfixChained to avoid the breaking change.

Resolves #241


Checklist:

  • Added the change to the changelog's "Unreleased" section with a link to this PR and your username
  • Linked any existing issues or proposals that this pull request should close
  • Updated or added relevant documentation in the README and/or documentation directory
  • Added a test for the contribution (if applicable)

@jacobpake jacobpake marked this pull request as draft November 24, 2025 14:28
@jamesdbrock
Copy link
Member

jamesdbrock commented Dec 3, 2025

Hi @jacobpake , thanks for the PR. Looks good and the tests pass. Is this ready for review?

I haven't used the Expr module much. That module was introduced by @cdepillabout . Dennis, do you have an opinion about this PR?

(Dennis, if you need a Purescript dev environment for running spago test, I recommend

nix develop github:thomashoneyman/purescript-overlay

)

@cdepillabout
Copy link
Member

I'm not using this anymore and don't have a strong opinion here. I'm happy to go with whatever you guys think is best.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Chaining of prefix and postfix operators

3 participants