Open jfmengels opened 1 year ago
Example of things the rule would report:
list |> List.map f |> List.head --> list |> List.head |> Maybe.map f List.head (List.map f list) --> Maybe.map f (List.head list)
Using List.take or List.drop:
List.take
List.drop
list |> List.map f |> List.take n --> list |> List.take n |> List.map f
Same for Array.slice:
Array.slice
array |> Array.map f |> Array.slice m n --> array |> Array.slice m n |> Array.map f
Tuples:
tuple |> Tuple.mapFirst f |> Tuple.first --> tuple |> Tuple.first |> f -- and similarly for second
For tuples, we could even notice unnecessary operations ✅
tuple |> Tuple.mapSecond f |> Tuple.first --> tuple |> Tuple.first -- and similarly for second
If you can think of other operations where mapping (or similar operations) can be improved, please mention it!
I am looking for:
Example of things the rule would report:
Using
List.take
orList.drop
:Same for
Array.slice
:Tuples:
For tuples, we could even notice unnecessary operations ✅
If you can think of other operations where mapping (or similar operations) can be improved, please mention it!
I am looking for: