Hi Kingsley, Regarding point 2, the Http.send <http://package.elm-lang.org/packages/elm-lang/http/1.0.0/Http#send> function enables you to create Cmd messages from http requests, and as you mentionned, Cmd.batch <http://package.elm-lang.org/packages/elm-lang/core/5.1.1/Platform-Cmd#batch> can group any Cmd messages together. Order of treatment of these commands however is not guaranted in my understanding.
Regarding point 1, if these are async (like http requests) my feelings are that you have no other choice than using the update function. This is because you need an effect manager for this. I guess you could also make your own effect manager but this seems to be something that is not encouraged in the community, and not documented. If you go the task way, the key functions are: toTask : Request a -> Task Error a andThen : (a -> Task x b) -> Task x a -> Task x b attempt : (Result x a -> msg) -> Task x a -> Cmd msg So you can chain your tasks with andThen, and finally once the "big" chained task is complete, create a command message with attempt. This said, if your purpose is dealing with navigation, don't hesitate to look at those two interesting articles from Wouter : https://medium.com/elm-shorts/more-on-spa-navigation-in-elm-31a066c6b9ae#.fnu1ejfzk https://medium.com/elm-shorts/choosing-the-right-elm-spa-architecture-d6e8275f6899#.qk45rxw8n Happy coding, Matthieu On Sunday, February 5, 2017 at 8:51:03 PM UTC+1, Kingsley Hendrickse wrote: > > Hi, > > I've just started learning Elm and am using version 0.18. > > I want to do 2 things: > > 1. Make an http get and use the result to make another get request > 2. Make 3 http requests (I don't mind whether they happen concurrently or > one after the other) > > Anyway after googling I found that in the previous version of Elm the Http > operations were done using Tasks. So on Task there was an andThen which > could be used. > > But in 0.18 it seems the new way of doing things is with Http send - but I > don't see how I can chain Http requests using the new send mechanism. It > also seems that in the 0.17 version you could > process the result inline but in 0.18 you have to use the update > mechanism. But that would suggest I would need to do a single http request > using send and capture the result in the update and then fire off another > send from the update - and catch it's result in the update again. Is that > how I should chain http requests in 0.18? > > I like how Cmd.batch can take a list of Cmd's to run - it would be nice if > there was an equivalent for doing Http requests. > > Any pointers would be appreciated > > --Kingsley > -- 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.