Closed MangelMaxime closed 8 months ago
Since the private
applies to all constructors, and how avoiding with
if a readable indentation approach is, I think, recommended, I feel the current behaviour is OK.
The fact that it keeps the code on a single line when there are no attached members may be an edge-case for single case DU; edge case which is favoured for conciseness of very simple type.
But this conciseness isn't the main concern when the DU also comes with members.
All in all, I feel the current behaviour is correct.
Since the
private
applies to all constructors, and how avoidingwith
if a readable indentation approach is, I think, recommended, I feel the current behaviour is OK.
Oh, I didn't know that private
for DUs was applied for all constructors. I was thinking it was on a case by case basis like member
.
With that in mind now, I think that indeed the current behaviour is probably correct.
I am going to close this issue but if maintainers of this repository think that a discussion is still needed, please feel free to re-open it.
Hello, the with
keyword is to be avoided and multiline body constructs typically start at the next line indented. This would be inconsistent with the rest of the guide.
Hello,
I hope I understood the guidelines of Fantomas correctly and that I am at the right place to discuss code style.
When creating a single case union with a private constructor Fantomas format it as:
However if we try to add a
static member
on it, it becomes:Which I feels a little strange to read because
private
is not on the same line as the "context it applies to".By manually fiddling with the code it seems like we could write it like that:
It is worth noting that in my project I am using
fsharp_multiline_bracket_style = stroustrup
which write record withstatic member
using thewith
keyword.What would be the recommended way to write such discriminated union? Should we keep the current formatting rule and make it explicit in the Guidelines or adhere to another formatting rule?