So I'm trying to do something a bit tricky. I want to send a message on a Channel to another coroutine, and then wait for a response. However if the response is sent before the sender starts listening, the message will be dropped. So I can't really send the message first and then start listening, as the other coroutine could reply first (race condition).
With standard coroutines I'd likely do something like:
val deferredReply = async { startListening(replyChannel) }
sendChannel.send(message)
val reply = defferedReply.await()
What would be the idomatic way to do this with Arrow? Is it asyncF I'm looking for?