
fj.data.IO Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of functionaljava Show documentation
Show all versions of functionaljava Show documentation
Functional Java is an open source library that supports closures for the Java programming language
The newest version!
package fj.data;
import fj.F;
import fj.Unit;
import fj.function.Try0;
import java.io.IOException;
/**
* IO monad for processing files
*
* @author Martin Grotzke
*
* @param the type of the result produced by the IO
*/
@FunctionalInterface
public interface IO extends Try0 {
A run() throws IOException;
default A f() throws IOException {
return run();
}
default SafeIO> safe() {
return IOFunctions.toSafeValidation(this);
}
default IO map(F f) {
return IOFunctions.map(this, f);
}
default IO bind(F> f) {
return IOFunctions.bind(this, f);
}
default IO append(IO iob) {
return IOFunctions.append(this, iob);
}
public static IO getContents() {
return () -> IOFunctions.getContents().run();
}
public static IO interact(F f) {
return () -> IOFunctions.interact(f).run();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy