use suspend function inside lambda of `open` method
doyaaaaaken opened this issue · 1 comments
doyaaaaaken commented
In the below code, a compile error happen because suspend function cannot be called inside lambda of open
function.
So make it callable.
suspend fun processRow(row: List<String>): List<String> {
return row.map { "prefix-$it" }
}
val rows: List<List<String>> = csvReader().open("test.csv") {
readAllAsSequence()
.map { row -> processRow(row) } // Compile ERROR!! processRow is suspend function so cannot call inside lambda
.toList()
}
Discusssion: https://kotlinlang.slack.com/archives/CMAL3470A/p1601651001001000
doyaaaaaken commented
released at v0.13.0