Given this this operator for evaluation of side effects in pipelines
let inline (|>!) a f = f a ; a
and this code snippet
This is not a bug, and it doesn't happen specifically for operators longer than two characters. This is a funny consequence of F#'s permissive offset rules.
When aligning lines of the same nestedness level, they have to be at the same indentation, like this:
let foo =
bar
baz
qux
But this is not allowed:
let foo =
bar
baz // Indented too much to the left
qux
And neither is this:
let foo =
bar
baz // Indented too little
qux
When dealing with constructs that create nested blocks, such as if
/then
, this rule is used to determine when the block is over: it's when the indentation alignment is broken.
let x =
if 1 = 1 then
bar
baz
qux
But there is an exception to this rule: if the line starts with an operator, then it is allowed to be shifted to the left by at most the operator size plus 1 characters, and it will still be considered to be at "current" indentation.
For example, this works:
let x =
1
+ 2
+ 3
But when you have operators of different sizes, it gets tricky. This works:
let x =
1
+ 2
+ 3
<> 6
But this doesn't:
let x =
1
+ 2
+ 3
<> 6