// Path: src/main/java/co/unruly/control/result/Result.java
// public static <S, F> Result<S, F> success(S value) {
//     return new Success<>(value);
// }


import java.util.function.BiFunction;
import java.util.function.Function;
import static co.unruly.control.result.Result.success;
package co.unruly.control.result;



public interface Combiners {

    /**
     * Combines two Results into a single Result. If both arguments are a Success, then
     * it applies the given function to their values and returns a Success of it.
     *
     * If either or both arguments are Failures, then this returns the first failure
     * it encountered.
     */
    static <A, B, F> Function<Result<A, F>, MergeableResults<A, B, F>> combineWith(Result<B, F> secondArgument) {
        // ugh ugh ugh we need an abstract class because otherwise it can't infer generics properly can i be sick now? ta
        return result -> new MergeableResults<A, B, F>() {
            @Override
            public <C> Result<C, F> using(BiFunction<A, B, C> combiner) {
                return result.either(
// Path: src/main/java/co/unruly/control/result/Result.java
// public static <S, F> Result<S, F> success(S value) {
//     return new Success<>(value);
// }


// Path: src/main/java/co/unruly/control/result/Combiners.java
import java.util.function.BiFunction;
import java.util.function.Function;
import static co.unruly.control.result.Result.success;

package co.unruly.control.result;



public interface Combiners {

    /**
     * Combines two Results into a single Result. If both arguments are a Success, then
     * it applies the given function to their values and returns a Success of it.
     *
     * If either or both arguments are Failures, then this returns the first failure
     * it encountered.
     */
    static <A, B, F> Function<Result<A, F>, MergeableResults<A, B, F>> combineWith(Result<B, F> secondArgument) {
        // ugh ugh ugh we need an abstract class because otherwise it can't infer generics properly can i be sick now? ta
        return result -> new MergeableResults<A, B, F>() {
            @Override
            public <C> Result<C, F> using(BiFunction<A, B, C> combiner) {
                return result.either(
                    s1 -> secondArgument.either(