Reason: refmt: keep new line characters when using infix operators

Created on 10 Oct 2019  路  1Comment  路  Source: reasonml/reason

It is often more readable to have line breaks when using infix operators.

example 1

thing |> doFirstThing |> doSecondThing |> doThirdThing  |> doFourthThing;

// vs

thing
|> doFirstThing
|> doSecondThing
|> doThirdThing
|> doFourthThing;

example 2:

thing >>= doFirstThing >>= doSecondThing >>= doThirdThing >>= doFourthThing;

// vs

thing
>>= doFirstThing
>>= doSecondThing
>>= doThirdThing
>>= doFourthThing;

refmt currently forces you into the first example when there are less than 80 characters on the line. I'd like to allow both styles.

Most helpful comment

Agreed! I think it makes sense to split into new lines when there are more than one operator and consider them a sequence.

Granted, this is a rather subjective subject.. 馃槃

E.g.

"hello" |> Foo.bar |> Foo.baz

would be:

"hello" 
|> Foo.bar 
|> Foo.baz;

>All comments

Agreed! I think it makes sense to split into new lines when there are more than one operator and consider them a sequence.

Granted, this is a rather subjective subject.. 馃槃

E.g.

"hello" |> Foo.bar |> Foo.baz

would be:

"hello" 
|> Foo.bar 
|> Foo.baz;
Was this page helpful?
0 / 5 - 0 ratings

Related issues

chenglou picture chenglou  路  3Comments

rickyvetter picture rickyvetter  路  3Comments

chenglou picture chenglou  路  3Comments

cristianoc picture cristianoc  路  4Comments

bluddy picture bluddy  路  3Comments