So I'm trying to do something a bit tricky. I want...
# arrow
m
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:
Copy code
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?
p
https://twitter.com/TheFpTower/status/1182652997853204480 eager (hot) vs lazy (cold), explained in a funny tweet 😄 Because async is eager these ordering problems are possible