You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/fsharp/style-guide/formatting.md
+17-15Lines changed: 17 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -395,26 +395,28 @@ let methods2 = System.AppDomain.CurrentDomain.GetAssemblies()
395
395
|> Array.concat
396
396
```
397
397
398
-
For reverse pipeline `<|` operators, place arguments on new lines and align them with the first argument:
398
+
For reverse pipeline `<|` operators, keep short expressions on a single line. When line length requires wrapping, place arguments on new lines and align them consistently:
399
399
400
400
```fsharp
401
-
// ✔️ OK
402
-
failwith <| sprintf "foobar: %s - foobarbaz: %s"
403
-
foobar
404
-
foobarbaz
401
+
// ✔️ OK - short expressions stay on one line
402
+
let result = someFunction <| arg1 <| arg2 <| arg3
405
403
406
-
// ✔️ OK
407
-
let message = sprintf "error: %s, details: %s"
408
-
<| errorMsg
409
-
<| details
404
+
// ✔️ OK - longer expressions can wrap when necessary
405
+
failwith
406
+
<| sprintf "A very long error message that exceeds reasonable line length: %s - additional details: %s"
407
+
longVariableName
408
+
anotherLongVariableName
410
409
411
-
// ✔️ OK
412
-
let result = someFunction <| arg1
413
-
<| arg2
414
-
<| arg3
410
+
// ✔️ OK - align continuation lines with the operator
0 commit comments