jean
05/25/2022, 8:25 AMfun interface PatchDevice<T> {
suspend operator fun invoke(
deviceId: String,
payload: T
): Either<Error, Action>
}
fun interface PatchDeviceAttribute<T> {
suspend operator fun invoke(
deviceId: String,
payload: T
): Either<Error, Action>
}
suspend fun <T> save(
patchDevice: PatchDevice<T>,
patchDeviceAttribute: PatchDeviceAttribute<T>
) {
either.eager<> {
val patchDeviceResult = patchDevice("")
}
}
The IDE complains that Restricted suspending functions can only invoke member or extension suspending functions on their restricted coroutine scope
when I call patchDevice()
What should I change to make it work?jean
05/25/2022, 8:28 AMsuspend
from both interfaces?raulraja
05/25/2022, 8:44 AM.eager
from the either
block. Just either { }
will work with suspensionjean
05/27/2022, 10:20 AM