-
Notifications
You must be signed in to change notification settings - Fork 145
Open
Labels
Description
Hello,
The current style guide does not give any guidance on where to put the when expression in match clauses.
Some examples:
match x with
| Y y when isOdd y -> "y is odd"
| Z z -> zIn small expressions, it makes sense to put the when expr after the pattern.
There is a bit of a problem when the when expr is getting large or contains multiple lines.
Some samples
My personal view on this is if you have a multiline when expression, you should probably refactor it to a partial active pattern and encapsulate your logic there.
Regardless, what advice should be given when this problem arises?
I'm interested in the position of the when keyword, newlines and/or indentations of the multiline expression and the position of the -> arrow.
Thoughts @dsyme and community?