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

Add missing List.take .drop on [] to simplification list #265

Closed morteako closed 9 months ago

morteako commented 9 months ago

This adds

List.take n []
--> []
List.drop n []
--> []

to the documentation list. I could not find them there, and I think they should be included (if i understand correctly). But it is possible they are included by some general "on empty lists"-statement?

These are currently implemented, executed and in the test suite: https://github.com/jfmengels/elm-review-simplify/blob/1180d1c1a795e645759b1d4abe12b565a4a686da/tests/SimplifyTest.elm#L15227

https://github.com/jfmengels/elm-review-simplify/blob/1180d1c1a795e645759b1d4abe12b565a4a686da/tests/SimplifyTest.elm#L15305

lue-bird commented 9 months ago

We have this line I guess: https://github.com/jfmengels/elm-review-simplify/pull/265/files#diff-6239bccafe2b75c7e560542732acf25d142d08608e1e0f0ffe9b53c09cfb1e0eR566

but some functions like intersperse have the List.operation ... [] --> [] listed regardless which is inconsistent.

I'd prefer removing those instead.

morteako commented 9 months ago

We have this line I guess: https://github.com/jfmengels/elm-review-simplify/pull/265/files#diff-6239bccafe2b75c7e560542732acf25d142d08608e1e0f0ffe9b53c09cfb1e0eR566

but some functions like intersperse have the List.operation ... [] --> [] listed regardless which is inconsistent.

I'd prefer removing those instead.

Ah, yes. My bad.

I guess it makes it a bit harder to search for simplifications for different functions, but that is probably not done very often by most people using elm-review-simplify.