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

repeat a value, then map is equivalent to repeat the mapped value #298

Open lue-bird opened 4 months ago

lue-bird commented 4 months ago
List.map f (List.repeat n a)
--> List.repeat n (f a)

Array.map f (Array.repeat n a)
--> Array.repeat n (f a)

String.map f (String.repeat n (String.fromChar a))
--> String.repeat n (f a)
-- note that the normal `String.repeat` does not work. a : String, f : Char -> Char

(found in the FSharpLint default config)