All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jio.Val Maven / Gradle / Ivy

The newest version!
package jio;

import static java.util.Objects.requireNonNull;

import java.util.concurrent.Callable;

/**
 * Represents a output, which is an irreducible expression. Values of type {@code Val} encapsulate a output of type
 * {@code O}. These values are terminal and represent the end result of an effectful computation.
 *
 * 

It's important to note that in the context of effectful computations, the {@code IO} type can * be either {@code Val} (irreducible) or {@code Exp} (composable expressions made up of different operations). While * {@code Val} represents a final output, {@code Exp} expressions are composable and can involve multiple sub-effects * that need to be executed in a specific order. * * @param the type of the output encapsulated by this {@code Val}. */ final class Val extends IO { private final Callable> effect; Val(final Callable> effect) { this.effect = requireNonNull(effect); } @Override public Result call() throws Exception { return effect.call(); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy