Is it possible to extend ReceiveChannels into Trav...
# arrow
d
Is it possible to extend ReceiveChannels into Traversable?
s
Can
ReceiveChannels
fold?
If you want to take a swing at it or help out with some kotlinx integration I'd love to help 👍
d
I'll give it a shot. Yes, they can fold but it's a
suspend fun
s
Could
ForReceiveChannel
be possible?
What is your use-case?
d
Well, it went away
But basically, I had an asynchronous channel using the Kotlin coroutines library. I wanted to traverse it and perform IO on each element sent on the channel, but also close the channel if an exception was raised.
So, something like...
ReceiveChannel<A>.(A -> IO<B>) -> IO<ReceiveChannel<B>>
Ugh, `ReceiveChannel`s are asynchronous is the problem.
ReceiveChannel<A>.(A -> IO<B>) -> IO<ReceiveChannel<B>>
makes sense but
ReceiveChannel<A>.(A -> List<B>) -> List<ReceiveChannel<B>>
does not
s
Because they're eager I am assuming?
d
Yeah