Hey germain, On Mon, Jun 20, 2016 at 11:23 PM, germain <[email protected]> wrote: > IT'S WORK, thank you so much William ~
No problem. > - Http.fromJson decoder (Task.succeed response) => why do you use > (Task.succeed response) ? And not just give as argument "response"? > Is it connected with `andThen` and its signature andThen : Task x a -> (a > -> Task x b) -> Task x b where a is "just" the response of the post request > which must be transformed into a Task by using Task.succeed succeed : a -> > Task x a in order to pass it to the fromJson function which requires > fromJson : Decoder a -> Task RawError Response -> Task Error a ? Exactly right, you answered your own question. Since we temporarily extracted the response value using `andThen`, we need to wrap it up with succeed again so that fromJson accepts it. Also the second argument to `andThen` is a function that must return a task, and since `decoded` returns a task, it works out. The error type has to be "Maybe" because we could hit a network error before we get a response. > - Do you know the difference between Task.Task and Platform.Task? They're the same. They're aliased to each other. Cheers, William --- https://jb55.com -- 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.
