/*
 * @author Ranides Atterwim <ranides@gmail.com>
 * @copyright Ranides Atterwim
 * @license WTFPL
 * @url http://ranides.net/projects/assira
 */

package net.ranides.assira.functional;

import net.ranides.assira.trace.ExceptionUtils;

/**
 *
 * @author Ranides Atterwim <ranides@gmail.com>
 */
public interface CheckedFunction<T,R,E extends Exception> {

    R apply(T value) throws E;

    default R $apply(T value) {
        try {
            return apply(value);
        } catch(Exception cause) {
            throw ExceptionUtils.rethrow(cause);
        }
    }
}
