navigation

CanBeReplacedWithComposition (FL0035)

Cause

A lambda function applies a single argument to a chain of function calls, two examples below:

fun x -> not(isValid(x)) fun x -> x |> isValid |> not

Rationale

The lambda functions are redundant.

How To Fix

Replace the lambda with function composition:

fun x -> not(isValid(x)) and fun x -> x |> isValid |> not are the same as isValid >> not

Rule Settings

{
    "canBeReplacedWithComposition": {
        "enabled": true
    }
}