Jannis
12/12/2019, 11:43 AMgetOrElse
has the signature fun <B> TryOf<B>.getOrElse(default: (Throwable) -> B): B
which means you must already have an Either
inside the Try
to have your code typecheck. Also Either<L, Nothing>
indicates that it is always Left
, which in your case makes sense because you always use the Left
constructor and kotlin infers B
to be Either<Error, Nothing>
.
Instead of getOrElse
, you should use toEither
or fold
.