Elm 0.17 Tasks
Here are some ways to convert Elm 0.16 code that uses Effects.task
into Elm 0.17.
The cases are sorted by priority, so use the first one that applies to your code.
Elm 0.16 example | Elm 0.17 equivalent |
---|---|
task |> Task.toMaybe |> Effects.task |
task |> Task.perform (always Nothing) Just |
task |> Task.toResult |> Effects.task |
task |> Task.perform Err Ok |
task |> Task.map action |> Effects.task |
task |> Task.Extra.performFailproof action |
task |> Effects.task |
task |> Task.Extra.performFailproof identity |
The function performFailproof
used in two places above is from package NoRedInk/elm-task-extra.
This recommendation comes from an elm-discuss posting by Janis Voigtländer on 2016-05-19.