lspitzner / brittany

haskell source code formatter
GNU Affero General Public License v3.0
691 stars 72 forks source link

Consider directly abutting record braces to the constructor name in patterns #284

Closed expipiplus1 closed 4 years ago

expipiplus1 commented 4 years ago

I was certain there was an issue already for this, but I couldn't find it.

Would it make sense to have no space between the record constructor name and the opening brace:

-- This
foo Bar{..} baz = noo Qux{ .. } boo

-- Currently it's this
foo Bar {..} baz = noo Qux { .. } boo

Although it's certainly no big deal, removing the space would make the precedence of the expression/pattern clearer.

At the moment at a quick glance one might thing foo and noo have arity three; without the space it's clear that the record contents are binding tightly to the constructor.

expipiplus1 commented 4 years ago

Indeed this already happens for empty braces

expipiplus1 commented 4 years ago

This might only look nice for single line record updates/matches however. And the consistency between single and multi line behavior is worth paying attention to.

lspitzner commented 4 years ago

See https://github.com/lspitzner/brittany/issues/251

expipiplus1 commented 4 years ago

I knew it! Thanks!