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

Skip conversion step for operations like isEmpty #157

Closed jfmengels closed 5 months ago

jfmengels commented 12 months ago
✅ #303
Dict.fromList >> Dict.isEmpty
--> List.isEmpty

✅ #303
Set.fromList >> Set.isEmpty
--> List.isEmpty

✅ #293
Dict.toList >> List.isEmpty
--> Dict.isEmpty

✅ #293
Set.toList >> List.isEmpty
--> Set.isEmpty

✅ #293
Dict.toList >> List.length
--> Dict.size

✅ #293
Set.toList >> List.length
--> Set.size

-- Note: This one doesn't work
Dict.fromList >> Dict.size
--> List.length

I'm sure we can find more operations like this for Dict/Set/List. And maybe there are similar things we can do for Maybe/Result.

morteako commented 5 months ago

@jfmengels Some of these got implemented in : https://github.com/jfmengels/elm-review-simplify/pull/293

The two missing (not including the one that doesn't work 😅 )

Dict.fromList >> Dict.isEmpty
--> List.isEmpty

Set.fromList >> Set.isEmpty
--> List.isEmpty
jfmengels commented 5 months ago

Implemented in #293 and #303.