```fun <L, R> attempt(f: () -> R, g: (Throwable) -...
# arrow
p
Copy code
fun <L, R> attempt(f: () -> R, g: (Throwable) -> Either<L, R>): Either<L, R> = 
  try { f().right() } catch (t: Throwable) { g(t) }