I would like to combine a Kotlin extension function on some receiver class Receiver with arrow-kt's either comprehension. In a regular Kotlin extension function, this binds to the receiver object; however, the either-comprehension EitherEffect shadows the Receiver this:
suspend fun Receiver.myFun(param: String): Either<Throwable, String> = either {
this.someMethod(...).bind() // Cannot access Receiver.someMethod, <this> is bound to EitherEffect
...
}
How can I access the receiver context within arrow's either-comprehension block (or any other monadic comprehension block)?
This is an issue inherited from Kotlin, but you can always access outer scoped
thisby referencing it by name. Here you can accessReceiverby referencing it bythis@myFun.However, you should be able to simply call
someMethodhere without referencingthis.Hope that solves your issue.