reason
reason copied to clipboard
refmt: keep new line characters when using infix operators
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.
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;