https://kotlinlang.org logo
#arrow
Title
# arrow
k

Kristian Nedrevold

01/16/2023, 1:19 PM
Where can I read about the changes to validated in arrow 2.0?
s

simon.vergauwen

01/16/2023, 1:27 PM
k

Kristian Nedrevold

01/16/2023, 1:37 PM
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

simon.vergauwen

01/16/2023, 1:50 PM
Yes, in practice not much changes. All the idioms and APIs remain the same.
k

Kristian Nedrevold

01/16/2023, 2:02 PM
Getting unresolved function on rightNel() though
and leftNel()
s

simon.vergauwen

01/16/2023, 2:02 PM
What version are you trying?
k

Kristian Nedrevold

01/16/2023, 2:04 PM
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

simon.vergauwen

01/16/2023, 2:07 PM
Yes, if that is not available then it should be added to 2.0.0
k

Kristian Nedrevold

01/16/2023, 2:10 PM
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

simon.vergauwen

01/16/2023, 2:18 PM
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

Kristian Nedrevold

01/16/2023, 2:27 PM
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

simon.vergauwen

01/16/2023, 2:36 PM
Right, I agree.
This would be a good moment to fade
validNel
out using
ReplaceWith
with
@Deprecation
21 Views