tryCatchK<R, A> static method

IOOption<R> Function(A a) tryCatchK<R, A>(
  1. R run(
    1. A a
    )
)

Converts a function that may throw to a function that never throws but returns a Option instead.

Used to handle synchronous computations that may throw using Option.

It wraps the IOOption.tryCatch factory to make chaining with flatMap easier.

Implementation

static IOOption<R> Function(A a) tryCatchK<R, A>(R Function(A a) run) =>
    (a) => IOOption.tryCatch(() => run(a));