https://kotlinlang.org logo
#arrow-contributors
Title
# arrow-contributors
s

Satyam Agarwal

05/07/2020, 4:22 PM
no, but you can do it like this :
Copy code
fun <A> Validated<NonEmptyList<YourType>, A>.toIO(): IO<A> {
    return when (this) {
        is Valid -> this.a.just()
        is Invalid -> YourErrorType(this.e).raiseError()
    }
}
👏🏼 1
🔝 2
a

antonicg

05/08/2020, 6:50 AM
right, or also you can call
toEither()
and then
toIO()
, but I was asking because, shouldn’t it be one? I am in to contribute if people think that makes sense for the library
p

pakoito

05/08/2020, 12:03 PM
Not for Validated in particular. Either makes sense for the suspend functions that return Either for errors are frequent.
2 Views