G-Research / fsharp-analyzers

Analyzers for F#
https://g-research.github.io/fsharp-analyzers/
Apache License 2.0
14 stars 1 forks source link

Take piped args into account in the PartialAppAnalyzer #23

Closed dawedawe closed 11 months ago

dawedawe commented 11 months ago

Although the targets of pipes are mostly partially applied functions, we shouldn't warn about them as such. Piping is pretty much an F# idiom to provide args to functions.

nojaf commented 11 months ago

I'll take another look at this tomorrow.

One thing that came to mind is the following: I guess we are looking at this problem from the application side of things. We check where function applications happen and want to assert if all parameters have been invocated. Are we solving the correct problem with this approach?

Example:

let f a b = ()
let g = f 1
let result = g 2

Should this code warn? Is the problem that f isn't called with two arguments? Or is the problem not happening as g is later called with the final argument and result doesn't have any leftovers?

We might want to ask the team for some feedback here.