-
Notifications
You must be signed in to change notification settings - Fork 143
Open
Description
Hello,
What should the guidance be for multiline (function?) applications in patterns?
Example:
match myString with
| Regex @"^(\w+) can fly (\d+) km/s for (\d+) seconds, but then must rest for (\d+) seconds\.$" [ name; speed; flyTime; restTime ] ->
()
Imagine this pattern doesn't respect the max_line_length
, how should it be formatted multiline?
This
match myString with
| Regex
@"^(\w+) can fly (\d+) km/s for (\d+) seconds, but then must rest for (\d+) seconds\.$"
[ name; speed; flyTime; restTime ] ->
()
comes to mind.
Related, patterns do seem to have some funky offset rules from time to time.
The same example wrapped in a record:
match myString with
| { X = Regex
@"^(\w+) can fly (\d+) km/s for (\d+) seconds, but then must rest for (\d+) seconds\.$"
[ name
speed
flyTime
restTime ] } ->
()
Notice that:
match myString with
| { X =
Regex
@"^(\w+) can fly (\d+) km/s for (\d+) seconds, but then must rest for (\d+) seconds\.$"
[ name
speed
flyTime
restTime ] } ->
()
is invalid F# code. (online tool)
Another interesting case is:
match myString with
| X(
Regex
@"^(\w+) can fly (\d+) km/s for (\d+) seconds, but then must rest for (\d+) seconds\.$"
[ name
speed
flyTime
restTime ]
) ->
()
This is valid code, thought the closing )
needs to be aligned with the X
column.
@dsyme any thoughts on this?
zawupf, abelbraaksma, edgarfgp and JustinWick
Metadata
Metadata
Assignees
Labels
No labels