Skip to content

Parenthesize lambdas on left side of operators#135

Open
dillonkearns wants to merge 1 commit intomdgriffith:mainfrom
dillonkearns:fix/pipeLeft-lambda-parens
Open

Parenthesize lambdas on left side of operators#135
dillonkearns wants to merge 1 commit intomdgriffith:mainfrom
dillonkearns:fix/pipeLeft-lambda-parens

Conversation

@dillonkearns
Copy link
Copy Markdown
Contributor

When a lambda appeared as the left operand of <|, it was rendered without parentheses:

\x -> x <| "hello"

Which is semantically different, it incorrectly results in this precedence when Elm parses it \x -> (x <| "hello").

The fix extends the existing right-side lambda parenthesization from #132 to also handle the left side.

When a lambda appeared as the left operand of <| (pipeLeft), it was
rendered without parentheses:

    \x -> x <| "hello"

This is parsed as \x -> (x <| "hello"), not (\x -> x) <| "hello".

The fix extends the existing right-side lambda parenthesization
(from PR mdgriffith#132) to also handle the left side.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants