Skip to content

Commit cbeec83

Browse files
committed
Merge pull request #252 from fakraemer/master
Fix #253: IOW.bind should not run the IO eagerly
2 parents b707324 + 77258ff commit cbeec83

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

core/src/main/java/fj/data/IOW.java

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,11 @@ public A run() throws IOException {
2525
return io.run();
2626
}
2727

28-
public <B> IOW<B> map(F<A, B> f) {
29-
return lift(() -> f.f(io.run()));
30-
}
28+
public <B> IOW<B> map(F<A, B> f) { return lift(IOFunctions.map(io, f)); }
3129

32-
public <B> IOW<B> bind(F<A, IO<B>> f) throws IOException {
33-
return lift(f.f(io.run()));
34-
}
30+
public <B> IOW<B> bind(F<A, IO<B>> f) { return lift(IOFunctions.bind(io, f)); }
3531

36-
public <B> IOW<B> append(IO<B> iob) {
37-
return lift(() -> {
38-
io.run();
39-
return iob.run();
40-
});
41-
}
32+
public <B> IOW<B> append(IO<B> iob) { return lift(IOFunctions.append(io, iob)); }
4233

4334
public IOW<LazyString> getContents() {
4435
return lift(() -> IOFunctions.getContents().run());

0 commit comments

Comments
 (0)