ZIO<R, E, A>.fromOptionOrFail constructor

ZIO<R, E, A>.fromOptionOrFail(
  1. Option<A> oa,
  2. E onNone()
)

Create a EIO from the given Option, succeeding when it is a Some, and failing with the result of onNone when it is a None.

Implementation

factory ZIO.fromOptionOrFail(
  Option<A> oa,
  E Function() onNone,
) =>
    ZIO.syncEither(() => oa.toEither(() => onNone()));