option method

Effect<E, Never, Option<R>> option()

{@category conversions}

Implementation

Effect<E, Never, Option<R>> option() => Effect.from(
      (context) => _unsafeRun(context).then(
        (exit) => switch (exit) {
          Left(value: final cause) => switch (cause) {
              Failure() => Right<Cause<Never>, Option<R>>(const None()),
              Die() => Left(cause),
              Interrupted() => Left(cause),
            },
          Right(value: final value) => Right(Some(value)),
        },
      ),
    );