hi, is there something like mapN for Validated? So...
# arrow
t
hi, is there something like mapN for Validated? Something like:
Copy code
fun <V1, V2, ..., V22, E, R)validatedMapN(v1: Validated<E,V1>, v2: Validated<E,V2>, ..., v22: V22, sg: Semigroup<E>, f: (V1, V2, ..., V22)->R): Validated<E, R>
f
I think there is
map
on Validated applicative that seems to look like what you want. Like this
Copy code
import arrow.core.Nel
import arrow.core.Validated
import arrow.core.extensions.nonemptylist.semigroup.semigroup
import arrow.core.extensions.validated.applicative.applicative

sealed class ValidationError

fun someValidation(): Validated<Nel<ValidationError>, String> = TODO()

fun main() {
    Validated.applicative(Nel.semigroup<ValidationError>())
        .map(
            someValidation(),
            someValidation(),
            someValidation(),
            someValidation(),
            someValidation(),
            someValidation(),
            someValidation()
        ) { (a, b, c, d, e, f, g) -> listOf(a, b, c, d, e, f, g) }
}
Or I am missing something 😄 Just it exists for 1 to 10 args from what I know
t
you are totally right. there is mapN on Validated.applicative(). Thanks
👍 2