pakoito
fun <L, R> attempt(f: () -> R, g: (Throwable) -> Either<L, R>): Either<L, R> = try { f().right() } catch (t: Throwable) { g(t) }