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

sort, then head is equivalent to minimum #296

Closed lue-bird closed 2 months ago

lue-bird commented 4 months ago
List.head (List.sort list)
--> List.minimum list

Sadly, no minimumBy and minimumWith exist.

(found in the FSharpLint default config)

morteako commented 3 months ago

I guess also

List.head (List.reverse (List.sort list))
--> List.maximum list
jfmengels commented 2 months ago

Fixed in https://github.com/jfmengels/elm-review-simplify/pull/305

jfmengels commented 2 months ago

I didn't think I would see this one report anything in practice, but at work I found both the List.minimum and the List.maximum cases, so this is very nice 😊