Learning Koka 2022-08-05

By Max Woerner Chase

So, I don't think I really explained this, but I'm sort of alternating what I'm focusing on in looking into in Koka. Yesterday, I was seeing how much of the script side of CGI could be implemented in Koka. Now, I'm sketching out how to handle structured concurrency.

So, let's see about that.

So far, I've got two distinct effects that I think need to be supported. One for "resume the current execution at some future point" or, in other words "schedule the resumption of the current code in the future". And one for "schedule an additional execution, and ensure that all such executions have completed at some future point".

These are the equivalents of await and nursery.start_soon() in Trio.

I poked around with this a little, and I am not sure I'm writing things correctly. I currently don't have an argument to the await function in the async effect, and I think it actually needs an argument to describe when to resume. Like, a higher-order function that takes the resume function as an argument. And some kind of queue to put them in, I guess...

Anyway, we'll see how much focus I have to put into this later. For now, I need to get to bed.

Good night.