I want to create my own `bind()` extension functio...
# arrow
j
I want to create my own
bind()
extension function to bind Akkurate's ValidationResult to Arrow's Raise blocks:
Copy code
either {
    someResult.bind()
}
However, this requires to use context receivers, which are currently JVM-only. What would you recommend to support multiplatform? Having two extension functions? One with context receivers for JVM, and another one with a parameter for other targets?
Copy code
@context(Raise<NonEmptySet<ConstraintViolation>>)
fun <T> ValidationResult<T>.bind()

fun <T> Raise<NonEmptySet<ConstraintViolation>>.bind(validationResult: ValidationResult<T>)
a
I would argue against that, because context receivers are still in flux... may for the time being you can do the one without contexts, I think it would be very useful even if the syntax is not 100% what one would expect
j
I thought Arrow was using them, but maybe they're only shown in the documentation but not used inside the codebase?
a
they are not used because it would make the library not apt for consumption... this is why we resort to "tricks" such as the
RaiseAccumulate
extending
Raise
since they are very useful even in their current form, we talk about them in the Design section of the docs
j
great! Thank you for the feedback 🙂