tap<A, B> function
- void f(
- B
Applies a side effect on a successful result of the TaskEither
without modifying it.
Example:
final original = of<String, int>(10);
tap<int, int>((value) => print(value))(original);
Implementation
TapFunctionEither<A, B> tap<A, B>(void Function(B) f) {
return (TaskEither<A, B> taskEither) {
taskEither.value().then((eitherResult) {
if (eitherResult is e.Right<A, B>) {
f(eitherResult.value);
}
}).catchError((_) {});
return taskEither;
};
}