Open
Description
How about having a suspending version of the fold
operator? Something like(please excuse the name):
suspend fun foldSuspend(fnL: suspend (L) -> Any, fnR: suspend (R) -> Any): Any =
when (this) {
is Left -> fnL(a)
is Right -> fnR(b)
}
Currently, it is:
fun fold(fnL: (L) -> Any, fnR: (R) -> Any): Any =
when (this) {
is Left -> fnL(a)
is Right -> fnR(b)
}
Is it a good practice to keep 2 versions of the same function?
Metadata
Metadata
Assignees
Labels
No labels