flatMap<C> method

  1. @override
IOEither<L, C> flatMap<C>(
  1. covariant IOEither<L, C> f(
    1. R r
    )
)
override

Used to chain multiple functions that return a IOEither.

You can extract the value of every Right in the chain without handling all possible missing cases. If running any of the IOs in the chain returns Left, the result is Left.

Implementation

@override
IOEither<L, C> flatMap<C>(covariant IOEither<L, C> Function(R r) f) =>
    IOEither(
      () => run().match(
        (l) => Either.left(l),
        (r) => f(r).run(),
      ),
    );