With this I get.
executeQuery : Json.Decoder a -> Task Http.RawError Response -> (Maybe a ->
b) -> Cmd b
executeQuery decoder callback action =
fromJson decoder callback
|> Task.toMaybe
|> Task.map action
|> Task.perform Basics.Extra.never
The right argument of (|>) is causing a type mismatch. 54| fromJson decoder
callback 55| |> Task.toMaybe 56| |> Task.map action 57|> |> Task.perform
Basics.Extra.never (|>) is expecting the right argument to be a: Task a b
-> c But the right argument is: (a -> b) -> Task Never a -> Cmd b
2016年5月19日木曜日 18時38分44秒 UTC+9 Janis Voigtländer:
>
> Import http://package.elm-lang.org/packages/elm-community/basics-extra,
> replace line |> Task.map action in your 0.17 code by |> Task.perform
> Basics.Extra.never action, give the function the return type Cmd b, done.
>
>
> 2016-05-19 11:18 GMT+02:00 Wyatt Benno <[email protected] <javascript:>>:
>
>> I am having the same issue.
>>
>> 0.16 code
>>
>> executeQuery : Json.Decoder a -> Task Http.RawError Response -> (Maybe a
>> -> b) -> Effects b
>> executeQuery decoder callback action =
>> fromJson decoder callback
>> |> Task.toMaybe
>> |> Task.map action
>> |> Effects.task
>>
>> 0.17 code
>>
>> executeQuery : Json.Decoder a -> Task Http.RawError Response -> (Maybe a
>> -> b) -> Platform.Task a b
>> executeQuery decoder callback action =
>> fromJson decoder callback
>> |> Task.toMaybe
>> |> Task.map action
>>
>> But this results in a different type so I cannot use it in the model
>> update.
>>
>> Any ideas?
>>
>> 2016年5月13日金曜日 22時56分39秒 UTC+9 Peter Damoc:
>>>
>>> There is no direct equivalent. You need a fail Msg. I'll just use NoOp
>>> for example purposes.
>>>
>>> authenticateInstagramOAuthCode : String -> Cmd.Cmd Msg
>>> authenticateInstagramOAuthCode code =
>>> post decodeInstagramUserInfo "/oauth/validate/instagram" (Http.string
>>> code)
>>> |> Task.toMaybe
>>> |> Task.perform (\_-> NoOp) LoadInstagramData
>>>
>>> Of course, you fi want to handle the failure, you can get rid of the
>>> `toMaybe`
>>>
>>> authenticateInstagramOAuthCode : String -> Cmd.Cmd Msg
>>> authenticateInstagramOAuthCode code =
>>> post decodeInstagramUserInfo "/oauth/validate/instagram" (Http.string
>>> code)
>>> |> Task.perform LoadFailure LoadInstagramData
>>>
>>>
>>>
>>>
>>> On Fri, May 13, 2016 at 10:56 AM, Zachary Kessin <[email protected]>
>>> wrote:
>>>
>>>>
>>>>
>>>>
>>>> Ok, I am trying to update to 0.17 in 0.16 I code like this
>>>>
>>>> authenticateDropboxOAuthCode : String -> Effects.Effects Action
>>>> authenticateDropboxOAuthCode code =
>>>> Http.post Instagram.decodeInstagramUserInfo "/oauth/validate/dropbox"
>>>> (Http.string code)
>>>> |> Task.toMaybe
>>>> |> Task.map LoadDropboxData
>>>> |> Effects.task
>>>>
>>>> In 0.17 I would think it would be like this, but the Cmd.task is not
>>>> right
>>>>
>>>> authenticateInstagramOAuthCode : String -> Cmd.Cmd Msg
>>>> authenticateInstagramOAuthCode code =
>>>> post decodeInstagramUserInfo "/oauth/validate/instagram" (Http.string
>>>> code)
>>>> |> Task.toMaybe
>>>> |> Task.map LoadInstagramData
>>>> |> Cmd.task
>>>>
>>>>
>>>> So what should it be?
>>>>
>>>> --
>>>> Zach Kessin
>>>> Your CRM Link
>>>> <http://yourcrm.link/?utm_source=email%20signature&utm_medium=email&utm_campaign=passive>
>>>> Twitter: @zkessin <https://twitter.com/zkessin>
>>>> Skype: zachkessin
>>>> ᐧ
>>>>
>>>> --
>>>> 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.
>>>>
>>>
>>>
>>>
>>> --
>>> There is NO FATE, we are the creators.
>>> blog: http://damoc.ro/
>>>
>> --
>> 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] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
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.