return flatMap("flatMap: " + func.getClass().getName(), func);
}
default Task<T> withSideEffect(final String desc, final Function1<? super T, Task<?>> func) {
ArgumentUtil.requireNotNull(func, "function");
final Task<T> that = this;
<BUG>return async("withSideEffect", context -> {
final Task<T> sideEffectWrapper = async(desc, ctx -> {</BUG>
SettablePromise<T> promise = Promises.settable();
if (!that.isFailed()) {
Task<?> sideEffect = func.apply(that.get());

return flatMap("flatMap: " + func.getClass().getName(), func);
}
default Task<T> withSideEffect(final String desc, final Function1<? super T, Task<?>> func) {
ArgumentUtil.requireNotNull(func, "function");
final Task<T> that = this;
Task<T> withSideEffectTask = async("withSideEffect", context -> {
final Task<T> sideEffectWrapper = async(desc, ctx -> {
SettablePromise<T> promise = Promises.settable();
if (!that.isFailed()) {
Task<?> sideEffect = func.apply(that.get());
