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
20 stars 9 forks source link

List.all/any on list with unnecessary element simplifications #262

Closed lue-bird closed 9 months ago

lue-bird commented 9 months ago

as hinted at in https://github.com/jfmengels/elm-review-simplify/pull/261#discussion_r1349564444

List.all identity [ a, True, b ]
--> List.all identity [ a, b ]

List.all not [ a, False, b ]
--> List.all not [ a, b ]

List.any identity [ a, False, b ]
--> List.any identity [ a, b ]

List.any not [ a, True, b ]
--> List.any not [ a, b ]

Bonus: Fixed a bug where List.filterMap with a non-identity function on a list with Nothing would remove the Nothing element.