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

Basic operations on integer literals #259

Closed jfmengels closed 9 months ago

jfmengels commented 9 months ago

In the following examples I'm using 1 but imagine any literal integer (so 1 but not 1.0)

Compositions of these functions:

jfmengels commented 9 months ago

Should we also simplify floor 1.2 to 1? :thinking:

lue-bird commented 9 months ago

To add:

round (round n) --> round n
ceiling (ceiling n) --> ceiling n
floor (floor n) --> floor n
truncate (truncate n) --> truncate n

including composition

can be done using operationDoesNotChangeResultOfOperationCheck and operationDoesNotChangeResultOfOperationCompositionCheck

jfmengels commented 9 months ago

Those don't type check so we don't have to handle them.

lue-bird commented 9 months ago

True, those don't return number, my mistake