mapBoth<C, D> method

Effect<E, C, D> mapBoth<C, D>(
  1. C fl(
    1. L l
    ),
  2. D fr(
    1. R r
    )
)

{@category mapping}

Implementation

Effect<E, C, D> mapBoth<C, D>(C Function(L l) fl, D Function(R r) fr) =>
    Effect.from(
      (context) => _unsafeRun(context).then(
        (exit) => switch (exit) {
          Left(value: final cause) => switch (cause) {
              Failure<L>(error: final error) => Left(Failure(fl(error))),
              Die() => Left(cause),
              Interrupted() => Left(cause),
            },
          Right(value: final value) => Right(fr(value)),
        },
      ),
    );