Re: [elm-discuss] Cmd.andThen
This does sound like a useful addition. Unlike most of the functions that people suggest adding to core, I don't think Cmd.andThen can be written by an end user (or library author). On Wed, Nov 30, 2016 at 7:19 AM, Mark Hamburgwrote: > A bigger issue going forward is that with effects managers, commands > aren't just shims around tasks. So, the notion that a module should expose > both a command-based interface and a task-based interface doesn't hold up > well in the long term. That leads me back to the notion that if commands > are the way to specify work to be done, then they need more of the > facilities that tasks offered. > > That said, I have no idea what Cmd.andThen would do with a batch command. > But are the batches for commands and subscriptions really better than lists? > > Mark > > On Wed, Nov 30, 2016 at 7:12 AM Max Goldstein > wrote: > >> Austin, you're exactly correct. Cmd is meant to be passed out to the >> runtime, that's it. >> >> The reason Http allows you to skip Task is for learnability. You can make >> a simple request without learning what a Task is. But we shouldn't be >> hobbled by that when we want to compose different types of effects. >> >> -- >> 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 elm-discuss+unsubscr...@googlegroups.com. >> 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 elm-discuss+unsubscr...@googlegroups.com. > 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 elm-discuss+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [elm-discuss] Cmd.andThen
A bigger issue going forward is that with effects managers, commands aren't just shims around tasks. So, the notion that a module should expose both a command-based interface and a task-based interface doesn't hold up well in the long term. That leads me back to the notion that if commands are the way to specify work to be done, then they need more of the facilities that tasks offered. That said, I have no idea what Cmd.andThen would do with a batch command. But are the batches for commands and subscriptions really better than lists? Mark On Wed, Nov 30, 2016 at 7:12 AM Max Goldsteinwrote: > Austin, you're exactly correct. Cmd is meant to be passed out to the > runtime, that's it. > > The reason Http allows you to skip Task is for learnability. You can make > a simple request without learning what a Task is. But we shouldn't be > hobbled by that when we want to compose different types of effects. > > -- > 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 elm-discuss+unsubscr...@googlegroups.com. > 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 elm-discuss+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [elm-discuss] Cmd.andThen
Austin, you're exactly correct. Cmd is meant to be passed out to the runtime, that's it. The reason Http allows you to skip Task is for learnability. You can make a simple request without learning what a Task is. But we shouldn't be hobbled by that when we want to compose different types of effects. -- 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 elm-discuss+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [elm-discuss] Cmd.andThen
As a relative newcomer to Elm, the impression I have is that Cmd is "special" and really part of the underlying runtime world. Maybe this is a misconception, but the impenetrability of Cmd gives it that sense. At the same time, Task is accessible, well supported, and put forward as the proper way to manage async tasks (certainly as opposed to Cmd). So my point is that - again, as a bit of a neophyte and not a heavy user of elm - that it seems strange to get Cmd from an API when Task would do. It feels like there's very little I can do with it, as opposed to Task which has pretty great support and lots of features. My two cents. Austin On Wed, Nov 30, 2016 at 3:31 PM Mark Hamburgwrote: > Yeah. And considering that the high-level web socket API is held up as the > standard of where things are going, it would seem the absence of exposed > chainable tasks is likely only to get worse. > > Another way to look at this as I think about it is: Why Cmd msg as opposed > to Task Never msg as a result type from update functions? Of course, one > can return whatever one wants from one's own update functions, but the > point is really why Cmds as opposed to Tasks as the standard way to > represent work to be done? > > > Mark > > On Tue, Nov 29, 2016 at 11:14 PM Max Goldstein > wrote: > > Hmm. I want to say it's an issue with the library, but fixing it would > involve changing a fair amount of code and using the low level Websocket > API. > > -- > 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 elm-discuss+unsubscr...@googlegroups.com. > 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 elm-discuss+unsubscr...@googlegroups.com. > 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 elm-discuss+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [elm-discuss] Cmd.andThen
Yeah. And considering that the high-level web socket API is held up as the standard of where things are going, it would seem the absence of exposed chainable tasks is likely only to get worse. Another way to look at this as I think about it is: Why Cmd msg as opposed to Task Never msg as a result type from update functions? Of course, one can return whatever one wants from one's own update functions, but the point is really why Cmds as opposed to Tasks as the standard way to represent work to be done? Mark On Tue, Nov 29, 2016 at 11:14 PM Max Goldsteinwrote: > Hmm. I want to say it's an issue with the library, but fixing it would > involve changing a fair amount of code and using the low level Websocket > API. > > -- > 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 elm-discuss+unsubscr...@googlegroups.com. > 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 elm-discuss+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [elm-discuss] Cmd.andThen
Hmm. I want to say it's an issue with the library, but fixing it would involve changing a fair amount of code and using the low level Websocket API. -- 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 elm-discuss+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [elm-discuss] Cmd.andThen
An example of a library that doesn't expose tasks is the Phoenix Socket library. I had a coworker ask me about sequencing joining a channel, pushing a message and waiting for a reply, and then leaving the channel. Without Tasks being exposed and without Cmd.andThen, that leaves one building the state sequence inside ones model which is sort of icky since most of the time it has no role in the model state. Mark > On Nov 29, 2016, at 5:18 PM, Max Goldsteinwrote: > > Http has an escape hatch to get a Task. Other libraries should do the same. > > Cmd is deliberately simple, with the hard work being done in Task. > > -- > 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 elm-discuss+unsubscr...@googlegroups.com. > 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 elm-discuss+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [elm-discuss] Cmd.andThen
Http has an escape hatch to get a Task. Other libraries should do the same. Cmd is deliberately simple, with the hard work being done in Task. -- 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 elm-discuss+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [elm-discuss] Cmd.andThen
I can't picture how this function would work. Could you give an example of where you would want to use it? Is this just a shortcut around having to make two passes through the update function? On Tue, Nov 29, 2016 at 1:27 PM, Mark Hamburgwrote: > With various libraries only returning commands instead of tasks, would it > be reasonable to add the following function (and could it be added without > going inside of the implementation for Cmd)? > > Cmd.andThen : (x -> Cmd y) -> Cmd x -> Cmd y > > The slippery slope is that we end up recreating much of Task in Cmd, but > the distinction between the two is somewhat vague — two constructs to cover > slightly more than one concept. > > Mark > > -- > 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 elm-discuss+unsubscr...@googlegroups.com. > 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 elm-discuss+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.