Yannick Lazzari
08/12/2022, 12:57 AMValidated
datatype? Or is it not possible? I think it would make composing validation functions easier.simon.vergauwen
08/12/2022, 7:15 AMEither
and Validated
because they cover the same ADT, but with different strategies.
They can be exposed from the same data type, if you name the APIs properly.
See following: https://github.com/arrow-kt/arrow/issues/2787
https://github.com/arrow-kt/arrow/pull/2778simon.vergauwen
08/12/2022, 7:18 AMvalidated<E, Int> {
val x: Int = validatedA.bind()
val y: Int = validatedB.bind()
x + y
}
If validatedA
is E
, then we can never advance this computation unless you have some value for x
. So validatedB.bind()
can never be executed, nor can its errors be accumulated.Yannick Lazzari
08/12/2022, 12:31 PM