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

Add Set.foldl/r simplifications #217

Closed lue-bird closed 1 year ago

lue-bird commented 1 year ago

Including parts from #2

-- The following simplifications for Set.foldl also work for Set.foldr
Set.foldl f initial Set.empty
--> initial
Set.foldl (\_ soFar -> soFar) initial set
--> initial

The added helpers are generic enough to be used for Dict/Array/String/List.foldlr as well

github-actions[bot] commented 1 year ago

The branch can be tried out by running:

elm-review --template jfmengels/elm-review-simplify/preview
lue-bird commented 1 year ago

No, elm-format runs fine. I just forgot to do it :)

jfmengels commented 1 year ago

Wait, you don't run it on save? :scream:

lue-bird commented 1 year ago

I do run it on save on all other projects but in simplify I use the elm-land plugin which sometimes gets tripped up when formatting on save (just stops the formatting task).

jfmengels commented 1 year ago

Aha, alright. Worth a bug report there probably :thinking: