List.sort >> List.sort is redundant and can be simplified to List.sort.
For List.sortWith f >> List.sortWith g, logically we could remove List.sortWith f, as whatever ordering f does gets overriden by g, but that's not always true, so we should not do this (unless we check and notice that f == g).
Counter-example where the double sorting has an effect (using sortBy which is similar):
data = [ ( 2, 2), ( 1, 100 ), ( 1, 1 ) ]
data |> List.sortBy Tuple.second |> List.sortBy Tuple.first
--> [(1,1),(1,100),(2,2)]
data |> List.sortBy Tuple.first
--> [(1,100),(1,1),(2,2)]
List.sort >> List.sort
is redundant and can be simplified toList.sort
.For
List.sortWith f >> List.sortWith g
, logically we could removeList.sortWith f
, as whatever orderingf
does gets overriden byg
, but that's not always true, so we should not do this (unless we check and notice thatf == g
).Counter-example where the double sorting has an effect (using
sortBy
which is similar):