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
19 stars 9 forks source link

Simplify Task.perform/Task.attempt when used with identity and Cmd #316

Open jfmengels opened 2 months ago

jfmengels commented 2 months ago
x |> Task.attempt identity |> Cmd.map fn
--> x |> Task.attempt fn

x |> Task.perform identity |> Cmd.map fn
--> x |> Task.perform fn

(seen in https://github.com/Flyp-Inc/lamdera-extra/blob/05c8c59187730265f0a9fd2312e3171171ccf3ac/src/Counter.elm#L192C22-L192C29)

Should we also simplify the following?

x |> Task.map fn |> Task.attempt identity
-->  x |> Task.attempt fn

x |> Task.map fn |> Task.perform identity
-->  x |> Task.perform fn
jmpavlick commented 2 months ago
image