conner
10/15/2021, 5:45 PMValidatedNel
?
fun buildMyObjectObject(token: String?, name: String?): ValidatedNel<Error, MyObject> =
Validated.fromNullable(token, { MissingField("token") }).toValidatedNel().zip(
Validated.fromNullable(name, { MissingField("name") }).toValidatedNel()) { token, name ->
MyObject(token, name)
}
it kind of feels like i "shouldn't" need to call toValidatedNel
for each Validated
raulraja
10/15/2021, 7:52 PMraulraja
10/15/2021, 7:52 PMraulraja
10/15/2021, 7:53 PMraulraja
10/15/2021, 7:54 PMraulraja
10/15/2021, 7:57 PMraulraja
10/15/2021, 7:57 PMraulraja
10/15/2021, 7:58 PMValidated<Nel<Error>>, String>
it knows how to infer the right version of zip
in which you don’t need to be explicit about the semigroup, but you still need to place the errors in Nelconner
10/15/2021, 8:27 PM