Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions docs/fsharp/style-guide/formatting.md
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,28 @@ let methods2 = System.AppDomain.CurrentDomain.GetAssemblies()
|> Array.concat
```

For reverse pipeline `<|` operators, place arguments on new lines and align them with the first argument:

```fsharp
// ✔️ OK
failwith <| sprintf "foobar: %s - foobarbaz: %s"
foobar
foobarbaz

// ✔️ OK
let message = sprintf "error: %s, details: %s"
<| errorMsg
<| details

// ✔️ OK
let result = someFunction <| arg1
<| arg2
<| arg3

// ❌ Not OK
failwith <| sprintf "foobar: %s - foobarbaz: %s" foobar foobarbaz
```

### Formatting lambda expressions

When a lambda expression is used as an argument in a multi-line expression, and is followed by other arguments,
Expand Down Expand Up @@ -571,6 +593,7 @@ The following operators are defined in the F# standard library and should be use
```fsharp
// ✔️ OK
x |> f // Forward pipeline
f <| x // Reverse pipeline
f >> g // Forward composition
x |> ignore // Discard away a value
x + y // Overloaded addition (including string concatenation)
Expand Down
Loading