func_type_result

Last updated:

0 purchases

func_type_result Image
func_type_result Images
Add to Cart

Description:

func type result

Features #
Simple functional result-type for alternative exception-handling.
Example #
final rand = Random();

T mightFail<T>(T value) {
if (rand.nextBool()) {
return value;
} else {
throw Exception("Woopsi!");
}
}

main() {
result(() => mightFail("Some value"))
.map((value) => value + "success")
.flatMap((value) => result(() => value.toInt()))
.whenErr((ex) => println(ex));
}
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.