https://kotlinlang.org logo
Title
d

deviant

03/07/2018, 2:30 PM
@elizarov
public fun <E, R> ReceiveChannel<E>.flatMap(context: CoroutineContext = Unconfined, transform: suspend (E) -> ReceiveChannel<R>): ReceiveChannel<R>
is there any chance we will see overloaded flatmap in the lib with such param signature
transform: (E) -> Iterable<R>
?
oups sorry, I read to fast
d

deviant

03/07/2018, 2:33 PM
yes. i want just to extract collection elements in the channel's element
j

Jonathan

03/07/2018, 2:35 PM
`Sequence<T>.flatMap(transform: (T) -> Iterable<R>): Sequence<R>`doesn't exist either...
I'd rather create
fun <T> Iterable<T>.toChannel(): ReceiveChannel<T> = produce { forEach { send(it) } }
e

elizarov

03/07/2018, 2:49 PM
We can have both. PRs are welcome
👍 1
i

ilya.gorbunov

03/08/2018, 11:33 PM
@elizarov That would be an overload on lambda return type, which isn't supported yet in overload resolution.
e

elizarov

03/09/2018, 8:00 AM
Oops. Right. That’s a pity. We’ll have to wait for new type inference for that.