Skip to content

Conversation

@spotandjake
Copy link
Member

I noticed that type T = (a => b) => c was being formatted to type T = a => b => c the formatter was seeing a single arugment and stripping the parameters however those are two completely different functions in grain as that is actually interpreted as type T = a => (b => c).

In order to fix this we simply don't strip the parenthesis on function types that accept a single function as their argument.

Notes:

  • I changed the parameter name in the tests of another function just so the module validates properly.

I noticed that `type T = (a => b) => c` was being formatted to `type T = a => b => c` the formatter was seeing a single arugment and stripping the parameters however those are two completely different functions in grain as that is actually interpreted as `type T = a => (b => c)`.

In order to fix this we simply don't strip the parenthesis on function types that accept a single function as their argument.

Notes:
* I changed the parameter name in the tests of another function just so the module validates properly.
@spotandjake spotandjake self-assigned this Jan 9, 2026
@spotandjake spotandjake added the grainfmt Issues related to the Grain formatter label Jan 9, 2026
@ospencer ospencer enabled auto-merge January 9, 2026 20:26
@ospencer ospencer added this pull request to the merge queue Jan 9, 2026
Merged via the queue into grain-lang:main with commit 3ea198c Jan 9, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

grainfmt Issues related to the Grain formatter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants