Zulip Chat Archive
Stream: lean4
Topic: As Task Join
Mac (Dec 23 2021 at 06:14):
Lean currently has methods to to produce an asynchronous task from a synchronous action (e.g., asTask : BaseIO a -> BaseIO (Task a)
and to bind a asynchronous action after a task bindTask : Task a -> (b -> BaseIO (Task a)) -> BaseIO (Task b)
, but there does not appear to be an efficient way to combine the two. That is, convert a synchronous action that returns a spawned a task (e.g., act : BaseIO (Task a)
) into an asynchronous action that performs that task afterwards (i.e., also a BaseIO (Task a)
). The only way I currently see to do this is to use act.asTask.map (·.map (·.get))
which does not seem particularly efficient.
Am I missing something? Is there already a better way to do this? If not, would adding an a method to do so efficiently the Lean core be reasonable?
Sebastian Ullrich (Dec 23 2021 at 08:29):
act.asTask.map (·.bind id)
? That doesn't seem particularly inefficient to me.
Mac (Dec 23 2021 at 10:58):
@Sebastian Ullrich thanks! good to know!
Last updated: Dec 20 2023 at 11:08 UTC