// Path: a-foundation/src/main/java/com/ajjpj/afoundation/concurrent/SuccessfulCompletionException.java
// public class SuccessfulCompletionException extends RuntimeException {
//     private final Object originalResult;
// 
//     public SuccessfulCompletionException (Object originalResult) {
//         this.originalResult = originalResult;
//     }
// 
//     /**
//      * @return the 'success' value result
//      */
//     public Object getOriginalResult () {
//         return originalResult;
//     }
// 
//     @Override public synchronized Throwable fillInStackTrace () {
//         return this;
//     }
// }
// 
// Path: a-foundation/src/main/java/com/ajjpj/afoundation/function/AFunction1.java
// public interface AFunction1<P, R, E extends Throwable> extends Serializable {
//     R apply(P param) throws E;
// }
// 
// Path: a-foundation/src/main/java/com/ajjpj/afoundation/function/APartialFunction.java
// public interface APartialFunction<P, R, E extends Throwable> extends AFunction1<P, R, E> {
//     boolean isDefinedAt (P param);
// }
// 
// Path: a-foundation/src/main/java/com/ajjpj/afoundation/function/AStatement1.java
// public interface AStatement1<P, E extends Throwable> extends Serializable {
//     void apply(P param) throws E;
// }
// 
// Path: a-foundation/src/main/java/com/ajjpj/afoundation/util/AUnchecker.java
// public class AUnchecker {
//     public static void throwUnchecked(Throwable th) {
//         AUnchecker.<RuntimeException> doIt(th);
//     }
// 
//     @SuppressWarnings("unchecked")
//     private static <T extends Throwable> void doIt(Throwable th) throws T {
//         throw (T) th;
//     }
// 
//     @SuppressWarnings("unused")
//     public static void executeUnchecked(AStatement0<? extends Throwable> callback) {
//         try {
//             callback.apply();
//         }
//         catch (Throwable exc) {
//             throwUnchecked (exc);
//         }
//     }
// 
//     public static <R> R executeUnchecked(AFunction0<R, ? extends Throwable> callback) {
//         try {
//             return callback.apply();
//         }
//         catch (Throwable exc) {
//             throwUnchecked (exc);
//             return null; //for the compiler
//         }
//     }
// }


import com.ajjpj.afoundation.concurrent.SuccessfulCompletionException;
import com.ajjpj.afoundation.function.AFunction1;
import com.ajjpj.afoundation.function.APartialFunction;
import com.ajjpj.afoundation.function.AStatement1;
import com.ajjpj.afoundation.util.AUnchecker;

        @Override public <E extends Throwable> ATry<T> recoverWith (APartialFunction<Throwable, ATry<T>, E> f) throws E {
            return this;
        }
    }

    static class AFailure<T> extends ATry<T> {
        final Throwable th;

        private AFailure (Throwable th) {
            this.th = th;
        }

        @Override public <X extends Throwable> void foreach (AStatement1<T, X> f) throws X {
        }

        @Override public ATry<Throwable> inverse () {
            return ATry.success (th);
        }

        @Override public <S, E extends Throwable> ATry<S> map (AFunction1<T, S, E> f) throws E {
            //noinspection unchecked
            return (ATry<S>) this;
        }

        @Override public boolean isSuccess () {
            return false;
        }

        @Override public T getValue () {
// Path: a-foundation/src/main/java/com/ajjpj/afoundation/concurrent/SuccessfulCompletionException.java
// public class SuccessfulCompletionException extends RuntimeException {
//     private final Object originalResult;
// 
//     public SuccessfulCompletionException (Object originalResult) {
//         this.originalResult = originalResult;
//     }
// 
//     /**
//      * @return the 'success' value result
//      */
//     public Object getOriginalResult () {
//         return originalResult;
//     }
// 
//     @Override public synchronized Throwable fillInStackTrace () {
//         return this;
//     }
// }
// 
// Path: a-foundation/src/main/java/com/ajjpj/afoundation/function/AFunction1.java
// public interface AFunction1<P, R, E extends Throwable> extends Serializable {
//     R apply(P param) throws E;
// }
// 
// Path: a-foundation/src/main/java/com/ajjpj/afoundation/function/APartialFunction.java
// public interface APartialFunction<P, R, E extends Throwable> extends AFunction1<P, R, E> {
//     boolean isDefinedAt (P param);
// }
// 
// Path: a-foundation/src/main/java/com/ajjpj/afoundation/function/AStatement1.java
// public interface AStatement1<P, E extends Throwable> extends Serializable {
//     void apply(P param) throws E;
// }
// 
// Path: a-foundation/src/main/java/com/ajjpj/afoundation/util/AUnchecker.java
// public class AUnchecker {
//     public static void throwUnchecked(Throwable th) {
//         AUnchecker.<RuntimeException> doIt(th);
//     }
// 
//     @SuppressWarnings("unchecked")
//     private static <T extends Throwable> void doIt(Throwable th) throws T {
//         throw (T) th;
//     }
// 
//     @SuppressWarnings("unused")
//     public static void executeUnchecked(AStatement0<? extends Throwable> callback) {
//         try {
//             callback.apply();
//         }
//         catch (Throwable exc) {
//             throwUnchecked (exc);
//         }
//     }
// 
//     public static <R> R executeUnchecked(AFunction0<R, ? extends Throwable> callback) {
//         try {
//             return callback.apply();
//         }
//         catch (Throwable exc) {
//             throwUnchecked (exc);
//             return null; //for the compiler
//         }
//     }
// }


// Path: a-foundation/src/main/java/com/ajjpj/afoundation/collection/immutable/ATry.java
import com.ajjpj.afoundation.concurrent.SuccessfulCompletionException;
import com.ajjpj.afoundation.function.AFunction1;
import com.ajjpj.afoundation.function.APartialFunction;
import com.ajjpj.afoundation.function.AStatement1;
import com.ajjpj.afoundation.util.AUnchecker;


        @Override public <E extends Throwable> ATry<T> recoverWith (APartialFunction<Throwable, ATry<T>, E> f) throws E {
            return this;
        }
    }

    static class AFailure<T> extends ATry<T> {
        final Throwable th;

        private AFailure (Throwable th) {
            this.th = th;
        }

        @Override public <X extends Throwable> void foreach (AStatement1<T, X> f) throws X {
        }

        @Override public ATry<Throwable> inverse () {
            return ATry.success (th);
        }

        @Override public <S, E extends Throwable> ATry<S> map (AFunction1<T, S, E> f) throws E {
            //noinspection unchecked
            return (ATry<S>) this;
        }

        @Override public boolean isSuccess () {
            return false;
        }

        @Override public T getValue () {
            AUnchecker.throwUnchecked (th);