Closed lue-bird closed 1 year ago
Previously, "map on wrap call" fixes did not try to preserve the "style" of wrap:
a |> List.singleton |> List.map f |> g --> [ a |> f ] |> g
We now keep the existing style for non-branching cases:
a |> List.singleton |> List.map f |> g --> (a |> f) |> List.singleton |> g
while branching styles are still over-written by using [ ... ] for list singletons
[ ... ]
(if c then List.singleton a else List.singleton b) |> List.map f |> g --> [ (if c then a else b) |> f) ] |> g
Not sure I'm super happy with the results but it's a bit nicer than before for sure.
Do you think we should also try to recover something like "the commonly used wrap style in all branches" or is that overkill?
The branch can be tried out by running:
elm-review --template jfmengels/elm-review-simplify/preview
Previously, "map on wrap call" fixes did not try to preserve the "style" of wrap:
We now keep the existing style for non-branching cases:
while branching styles are still over-written by using
[ ... ]
for list singletonsNot sure I'm super happy with the results but it's a bit nicer than before for sure.
Do you think we should also try to recover something like "the commonly used wrap style in all branches" or is that overkill?