Stream: beginners

Topic: parallel tasks


view this post on Zulip sqwishy (Sep 13 2024 at 23:48):

Hi I'm trying to write a program that runs subprocesses in parallel but I'm not sure if/how roc can run tasks in parallel yet?

I thought Task.batch was what I wanted (assuming it was similar to Platform.Cmd.batch in Elm) but, after reading the docs for Task.batch, I'm not sure what it does but it doesn't seem to do what I want.

I tried creating a list of tasks (from Sleep.millis) and taking them one at a time using Task.loop, thinking maybe enqueuing them before awaiting them would schedule them. But this appears to run them in sequence (similar to polling futures one at a time in tokio I think?).

Is running a sequence of tasks at the same time possible and I'm just missing something in the docs that explains how?

view this post on Zulip Brendan Hansknecht (Sep 14 2024 at 01:02):

It essentially isn't supported currently.

view this post on Zulip Brendan Hansknecht (Sep 14 2024 at 01:07):

I mean basic webserver runs multiple threads at the same time. So many tasks are running in parallel. But no current platform supports spawning multiple tasks running on various threads and rejoining the result like future with join all.

view this post on Zulip sqwishy (Sep 14 2024 at 01:09):

Oh okay, so the current http package makes a thread per connection I guess?

view this post on Zulip Brendan Hansknecht (Sep 14 2024 at 02:00):

I don't think it is threaded at all. Just makes blocking http requests when called.

view this post on Zulip Brendan Hansknecht (Sep 14 2024 at 02:00):

But I don't recall the exact impl


Last updated: Jul 05 2025 at 12:14 UTC