Oh, and of course, if task was something not involving Task.toMaybe or
Task.toResult (for, example, task could have been simply Task.succeed ...),
then:

If in 0.16 you had:

task |> Effects.task

use the following in 0.17:

task |> Task.perform never identity

​

2016-05-19 12:37 GMT+02:00 Janis Voigtländer <[email protected]>:

> Questions how to do migrate 0.16 code involving Effects.task to 0.17 have
> come up repeatedly now, so I thought it makes sense to write down general
> advice about this. Below is *my* advice. In each of the cases below, I
> first give a snippet of 0.16 code and what I advise to use as equivalent
> 0.17 code. In each case, when the 0.16 version has some type of the form 
> Effects
> SomeType, the 0.17 code I give has type Cmd SomeType (for the same
> SomeType, of course).
>
> So, here goes:
>
> If in 0.16 you had:
>
> task |> Task.toMaybe |> Effects.task
>
> use the following in 0.17:
>
> task |> Task.perform (always Nothing) Just
>
> ------------------------------
>
> If in 0.16 you had:
>
> task |> Task.toMaybe |> Task.map action |> Effects.task
>
> use the following in 0.17:
>
> task |> Task.toMaybe |> Task.perform never action
>
> ------------------------------
>
> If in 0.16 you had:
>
> task |> Task.toResult |> Effects.task
>
> use the following in 0.17:
>
> task |> Task.perform Err Ok
>
> ------------------------------
>
> If in 0.16 you had:
>
> task |> Task.toResult |> Task.map action |> Effects.task
>
> use the following in 0.17:
>
> task |> Task.toResult |> Task.perform never action
>
> ------------------------------
>
> The function never used in two places above is from
> http://package.elm-lang.org/packages/elm-community/basics-extra.
> ​
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to