// WITH_STDLIB fun foo(a: Result): T = bar(a) { it.getOrThrow() } fun interface FunIFace { fun call(ic: T): R } fun bar(value: T, f: FunIFace): R { return f.call(value) } fun box(): String { val res = foo(Result.success(40)) + 2 return if (res != 42) "FAIL $res" else "OK" }