One solution is to use a match expression: val b: Int | Throwable = a match case Right(value) => value case Left(error) => error
Depending on your situation, getOrElse can be another good solution: val b = eLeft.getOrElse(0) // 0
Another usual approach is to just write your code like normal, only really worrying about the success case, and the failure case eventually takes care of itself.
Collection
[
|
...
]