I have the following functions : ```fun interface ...
# arrow
j
I have the following functions :
Copy code
fun 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?
Is the only possible way to fix this by removing
suspend
from both interfaces?
r
Remove
.eager
from the
either
block. Just
either { }
will work with suspension
🔝 1
j
So I ended up with a compilation error when doing this. I’m not really sure what’s going on though : https://youtrack.jetbrains.com/issue/KT-52540
👍 2