tap<A> function
Execute a side effect on the wrapped value, if the Option is a Some.
expect(
O.some(1).chain(O.tap(print)), // Prints '1' to the console
equals(O.some(1)),
);
Implementation
Option<A> Function(Option<A> option) tap<A>(
void Function(A value) f,
) =>
map((a) {
f(a);
return a;
});