👍👍👍

On Mon, Nov 21, 2016 at 7:04 PM, Charlie Koster <[email protected]> wrote:

> I'm a fan of the changes to Task.perform in Elm 0.18. However, I'm still
> finding that I'm writing a lot of boilerplate in some situations. For
> example, there are several instances when I want to send a msg which has no
> payload.
>
> Task.perform (\_ -> GoToLoginPage) (Task.succeed Nothing)
>
> I do this any time I am navigating to a different page, submitting a form,
> cancelling a form, kicking off any asynchronous request (logging in,
> CRUDing any data), and maybe one or two other special cases.
>
> I don't see any reason why not have a function in Task that takes a msg
> and returns a Cmd msg.
>
> sendMsg : msg -> Cmd msg
>
> Which could be used like this
>
> Task.sendMsg GoToLoginPage
> Task.sendMsg GoToOneOfTenOtherPages
> Task.sendMsg IsFetchingData
> Task.sendMsg IsUpdatingData
> Task.sendMsg IsCreatingData
> Task.sendMsg IsDeletingData
> Task.sendMsg CancelCreate
> Task.sendMsg CancelDelete
> Task.sendMsg LogoutSucceed
> ...
>
> Any thoughts on this proposed addition? Does anyone else find themselves
> writing a lot of boilerplate with Task.perform?
>
> --
> 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.
>

-- 
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