package scotch.data.ratio;
import static java.util.Arrays.asList;
import static scotch.runtime.RuntimeSupport.callable;
import java.util.List;
import scotch.data.eq.Eq;
import scotch.runtime.Callable;
import scotch.symbol.InstanceGetter;
import scotch.symbol.TypeInstance;
import scotch.symbol.TypeParameters;
import scotch.symbol.type.TypeDescriptor;
@SuppressWarnings("unused")
@TypeInstance(typeClass = "scotch.data.eq.Eq")
public class EqRatio<A> implements Eq<Ratio<A>> {
private static final Callable<EqRatio> INSTANCE = callable(EqRatio::new);
@InstanceGetter
public static Callable<EqRatio> instance() {
return INSTANCE;
}
@TypeParameters
public static List<TypeDescriptor> parameters() {
return asList(Ratio.TYPE);
}
@Override
public Callable<Boolean> eq(Callable<Ratio<A>> left, Callable<Ratio<A>> right) {
return callable(() -> left.call().equals(right.call()));
}
}