jfmengels / elm-review-simplify

Provides elm-review rules to simplify your Elm code
https://package.elm-lang.org/packages/jfmengels/elm-review-simplify/latest/
BSD 3-Clause "New" or "Revised" License
19 stars 9 forks source link

filter, then isEmpty is equivalent to not any #297

Open lue-bird opened 7 months ago

lue-bird commented 7 months ago
List.isEmpty (List.filter isOdd list)
--> not (List.any isOdd list)

(strangely, no other published elm/... module exposes both any and filter.)

If we want to save an extra step, we can also introduce separate checks for the negated applications like

not (List.isEmpty (List.filter isOdd list))
--> List.any isOdd list

(found in the FSharpLint default config)