Where can I read about the changes to validated in...
# arrow
k
Where can I read about the changes to validated in arrow 2.0?
s
k
rightNel() replaces validNel() then? and leftNel() replaces invalidNel(). Are these extensions implemented in arrow 2.0? I can see them in the new docs in the PR, but they don't seem to be implemented?
Ah, nevermind I misunderstood it as ValidatedNel being deprecated for Either<Nel... I see now that there is EitherNel
s
Yes, in practice not much changes. All the idioms and APIs remain the same.
k
Getting unresolved function on rightNel() though
and leftNel()
s
What version are you trying?
k
Copy code
private fun validLength(value: String): EitherNel<SecretError, InternalSecret> =
            if (value.length > 16)  InternalSecret(value).right()
            else SecretError.NotEnoughCharacters.leftNel()
I'm guessing leftNel() is something like
Copy code
fun <E, T> E.leftNel(): EitherNel<E, T> = nonEmptyListOf(this).left()
Copy code
implementation(platform("io.arrow-kt:arrow-stack:2.0.0-SNAPSHOT"))
s
Yes, if that is not available then it should be added to 2.0.0
k
as a side note. The old validNel() is kind of strange right?
because invalidNel = leftNel != left and that sounds good but also vanlidNel = right = rightNel
s
rightNel
or
validNel
theoretically doesn't really make a lot of sense perse because of
Nothing
in the
E
type argument. Practically many people prefer to use
rightNel
though... this could indeed be completely omitted.
k
rightNel() could mean Nel<T> though
so Either<Nel<E>, Nel<T>>
Obviously rightNel won't be there for that type signature so It's not a real problem
I personally just think that rightNel seems unnecessary
s
Right, I agree.
This would be a good moment to fade
validNel
out using
ReplaceWith
with
@Deprecation