Youssef Shoaib [MOD]
11/15/2024, 1:31 PMeither {
accumulate {
ensureOrAccumulate(false) { "hello" }
this@either.raise("hi".nel())
}
}
This results in nonEmptyListOf("hi").left(), but I can see an argument for it being nonEmptyListOf("hi").left(). It gets even more strange with early returns:
either {
accumulate {
ensureOrAccumulate(false) { "hello" }
return@either 42
}
}
Results in Right(42), but the very similar:
either {
accumulate {
ensureOrAccumulate(false) { "hello" }
42
}
}
results in nonEmptyListOf("hello").left()
Is this expected? Should the accumulated errors be raised instead?Alejandro Serrano.Mena
11/15/2024, 1:56 PMRaise, the behavior depends completely on that oneAlejandro Serrano.Mena
11/15/2024, 1:57 PMthis@either.raise or return@eitherYoussef Shoaib [MOD]
11/15/2024, 2:01 PM