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.