Hi, I have a question about `Option`: ``` @JvmS...
# arrow
d
Hi, I have a question about `Option`:
Copy code
@JvmStatic
    @JvmName("tryCatch")
    inline fun <A> catch(recover: (Throwable) -> Unit, f: () -> A): Option<A> =
      try {
        Some(f())
      } catch (t: Throwable) {
        recover(t.nonFatalOrThrow())
        None
      }
Why recover is
(Throwable) -> Unit
not
(Throwable) -> Option<A>
? Shouldn’t the caller decide if the exception should be mapped to
None
or
Some
?
t
I think you can have a look at
Either.catch { }
👍 1
d
With
Either
it is a different case -> I can use
handleErrorWith
to transform
Exception
to right or left. With
Option
I have no such ability. That’s why I think that recover for
Option
should not only allow a
side effect
.