Skip to content
This repository was archived by the owner on Aug 31, 2022. It is now read-only.

Commit c0eed2e

Browse files
committed
more direct implementation of async map
1 parent 200d064 commit c0eed2e

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

cli/src/main/java/io/rouz/task/cli/TaskConstructor.java

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package io.rouz.task.cli;
22

33
import io.rouz.task.Task;
4-
54
import joptsimple.OptionParser;
65

76
/**

workflow/src/main/java/io/rouz/task/TaskBuilders.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ private static final class ChainingEval<F> implements Serializable {
335335

336336
public <Z> EvalClosure<Z> enclose(F f) {
337337
//noinspection unchecked
338-
return tc -> (Value<Z>) fClosure.apply(tc).apply(f);
338+
return taskContext -> (Value<Z>) fClosure.apply(taskContext).apply(f);
339339
}
340340

341341
public <G> ChainingEval<G> chain(F1<TaskContext, F1<G, Value<F>>> mapClosure) {

workflow/src/main/java/io/rouz/task/context/AsyncContext.java

+5
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ public void consume(Consumer<T> consumer) {
8080
future.thenAccept(consumer);
8181
}
8282

83+
@Override
84+
public <U> Value<U> map(Function<? super T, ? extends U> fn) {
85+
return new FutureValue<>(future.thenApply(fn));
86+
}
87+
8388
@Override
8489
public <U> Value<U> flatMap(Function<? super T, ? extends Value<? extends U>> function) {
8590
return flatten(future.thenApply(function));

0 commit comments

Comments
 (0)