joelpedraza
06/28/2017, 9:40 PMinline infix fun <T, R> T.resultOf(f: (T).() -> R): Result<R, Throwable> = try {
Result.Ok<R, Throwable>(f())
} catch (rt: RuntimeException) {
throw rt
} catch (tr: Throwable) {
Result.Error<R, Throwable>(tr)
}