fold<R, L, A, B> function

ReaderTask<R, B> Function(ReaderTaskEither<R, L, A>) fold<R, L, A, B>(
  1. B onLeft(
    1. L left
    ),
  2. B onRight(
    1. A right
    )
)

Unwraps the Either value, returning a ReaderTask that resolves to the result.

onRight is run if the value is an Right, and onLeft for Left.

Implementation

ReaderTask<R, B> Function(ReaderTaskEither<R, L, A>) fold<R, L, A, B>(
  B Function(L left) onLeft,
  B Function(A right) onRight,
) =>
    (fa) => ReaderTask((r) => fa(r).p(TE.fold(onLeft, onRight)));