Skip to content

Parenthesize lambdas on left side of operators#135

Merged
mdgriffith merged 1 commit into
mdgriffith:mainfrom
dillonkearns:fix/pipeLeft-lambda-parens
Apr 21, 2026
Merged

Parenthesize lambdas on left side of operators#135
mdgriffith merged 1 commit into
mdgriffith: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>
@mdgriffith mdgriffith merged commit de61886 into mdgriffith:main Apr 21, 2026
1 check passed
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.

3 participants