suspend fun Flow<AllStates>.assertTransition(oldState: AllStates, newState: AllStates) {
...
}
// into (by providing the oldState argument...):
suspend fun Flow<AllStates>.assertTransition(newStates: AllStates) {
...
}
dave08
05/17/2023, 1:10 PM
I think I need partially3 and to change the order of oldState and newState...
y
Youssef Shoaib [MOD]
05/18/2023, 4:00 PM
Just use a lambda:
Copy code
val assertTransitionCurried: suspend Flow<AllStates>.(AllStates) -> Unit = { assertTransition(it) }
d
dave08
05/18/2023, 4:02 PM
Yeah, that's probably simpler in this case... 😊. I wonder where all these partials and currieds really come to use then?
y
Youssef Shoaib [MOD]
05/18/2023, 4:04 PM
They come to use when there's a simple case. Keep in mind though that Kotlin, by design, doesn't work well with function composition and transformations like that. The "Kotlin way" is to use lambdas to transform the shape of functions