[elm-discuss] Re: Batching HTTP requests and then performing something after they all finish

2017-12-01 Thread Brian Hicks
It sounds like you might actually want to do this in update! You're going 
to have to write an Msg for getting new album covers anyway, right? And, 
conceptually, it sounds like you want to save the results you get but cache 
them for future use through a port.

Your logic branches there, so it makes sense to say, in response to your 
Msg, "save these to display to the user. Also, store them so I don't have 
to make this request again."

If my assumption there is wrong, please correct me. The mechanical way to 
do *exactly *what you're asking is putting your tasks in Task.sequence and 
sending the result through Task.andThen. But I'm not sure you want to do 
that, for the reasons above. Your task handling logic would get really 
hairy, when it has a natural fit in the Elm Architecture.

On Friday, December 1, 2017 at 7:28:08 AM UTC-6, Rafał Cieślak wrote:
>
> I have a dict which acts as an album cover cache:
>
> 1. I download a list of albums from Last.fm.
> 2. I send a separate request for each album to get its cover image URL 
> (right now i use Cmd.batch).
> 2.1 After I receive an image URL from Last.fm, I add it to the cache, so 
> that I have a mapping from album ID to album image URL.
> 3. Once all the album image URL requests finish (no matter if any of them 
> fails), I'd like to send the cache through a port so that JS can save it in 
> localStorage.
>
> I don't know how to approach this. The Cmd API allows for batching, but 
> not sequencing and the Task API allows for sequencing, but not batching. I 
> can turn a Task into Cmd, but not the other way around.
>
> So if I have a bunch of batched HTTP requests, I'm not really able to 
> sequence something after they happen, or at least I don't see how I can do 
> this without adding some dirty workarounds to the update function.
>
> Theoretically I could wrap the album image URLs into RemoteData and then 
> after receiving any of them, see if the rest of the album image URLs is 
> finished and if so, send the cache to JS.
>

-- 
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] The Elm Discourse is Ready

2017-12-01 Thread John Orford
Great work!

On Fri, 1 Dec 2017 at 16:30 Brian Hicks  wrote:

> Hey all,
>
> The Elm Discourse is now live at https://discourse.elm-lang.org. Hosting
> has been graciously provided by discourse.org. You can log in with your
> existing Google or GitHub accounts, or an email and password of your choice.
>
> As I mentioned earlier this week, we intend to replace Google Groups with
> Discourse if everything shakes out OK. There are more details on the site:
> https://discourse.elm-lang.org/t/transition-plan-from-google-groups/20/3.
> To summarize: we'd appreciate if you could take new threads to Discourse so
> we can give it a solid run. We will likely not be able to migrate existing
> discussions, but we will retain this list in read-only mode so that
> existing discussions will not be lost. We hope existing discussions can
> continue and finish up over here so that those threads are not separated
> and hard to join later.
>
> We're going to try an experiment around discussion categories. Right now,
> we have these:
>
> 1. Learn
> 2. Request Feedback
> 3. Show and Tell
>
> The idea is to select your intention for writing the post and things
> should sort themselves out automatically. People get what they need, and we
> all communicate in a healthy way. There's a thread on the forum where we
> hashed out the design decisions for these categories. If you get stuck on
> which category a post belongs in, feel free to contact me privately however
> makes sense to you and I'll help you out. :)
>
> Thanks, and see you there.
> Brian
>
> P.S. It's completely possible to maintain an email-only interface if you
> are so inclined. Once you sign up, go to your settings (click your picture
> in the top right, then the gear icon.) From there, select "Emails" and then
> "Enable mailing list mode." That said, the web interface is much nicer than
> it is here; give it a try.
>
> --
> 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.


[elm-discuss] The Elm Discourse is Ready

2017-12-01 Thread Brian Hicks
Hey all,

The Elm Discourse is now live at https://discourse.elm-lang.org 
. Hosting has been graciously provided by 
discourse.org . You can log in with your existing Google 
or GitHub accounts, or an email and password of your choice.

As I mentioned earlier this week, we intend to replace Google Groups with 
Discourse if everything shakes out OK. There are more details on the site: 
https://discourse.elm-lang.org/t/transition-plan-from-google-groups/20/3 
. To 
summarize: we'd appreciate if you could take new threads to Discourse so we can 
give it a solid run. We will likely not be able to migrate existing 
discussions, but we will retain this list in read-only mode so that existing 
discussions will not be lost. We hope existing discussions can continue and 
finish up over here so that those threads are not separated and hard to join 
later.

We're going to try an experiment around discussion categories. Right now, we 
have these:

1. Learn
2. Request Feedback
3. Show and Tell

The idea is to select your intention for writing the post and things should 
sort themselves out automatically. People get what they need, and we all 
communicate in a healthy way. There's a thread on the forum where we hashed out 
the design decisions for these categories. If you get stuck on which category a 
post belongs in, feel free to contact me privately however makes sense to you 
and I'll help you out. :)

Thanks, and see you there.
Brian

P.S. It's completely possible to maintain an email-only interface if you are so 
inclined. Once you sign up, go to your settings (click your picture in the top 
right, then the gear icon.) From there, select "Emails" and then "Enable 
mailing list mode." That said, the web interface is much nicer than it is here; 
give it a try.

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