Elm-format: Use <| when possible?

Created on 9 May 2017  路  2Comments  路  Source: avh4/elm-format

Should this code:

                currentNamespace.class
                    (if showLabels then
                        []
                     else
                        [ LabelText ]
                    )

automatically become:

                currentNamespace.class <|
                    if showLabels then
                        []
                    else
                        [ LabelText ]
discussion

Most helpful comment

I like this idea overall. In the vein of "elm-format makes consistent style decisions for you," I think "avoid multiline expressions that are wrapped in parentheses" is a good one.

All 2 comments

"When possible" is important, especially considering things like https://github.com/avh4/elm-format/issues/362

I like this idea in general, but although this works...

          something
               |> currentNamespace.class
                    (if showLabels then
                        []
                     else
                        [ LabelText ]
                    )

...it would be bad to rewrite that into a precedence conflict!

          something
               |> currentNamespace.class <|
                    if showLabels then
                        []
                     else
                        [ LabelText ]

I like this idea overall. In the vein of "elm-format makes consistent style decisions for you," I think "avoid multiline expressions that are wrapped in parentheses" is a good one.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ahstro picture ahstro  路  4Comments

rtfeldman picture rtfeldman  路  4Comments

avh4 picture avh4  路  5Comments

welblaud picture welblaud  路  3Comments

sporto picture sporto  路  7Comments