public static final TCon ADDITIVE = con("Prelude", "Additive");
public static final TCon MONAD = con("Prelude", "Monad");
+ public static final TCon MONAD_E = con("Prelude", "MonadE");
public static final TCon INTEGRAL = con("Prelude", "Integral");
public static final TCon RING = con("Prelude", "Ring");
public static final TCon ORDERED_RING = con("Prelude", "OrderedRing");
public static final TCon REAL = con("Prelude", "Real");
public static final TCon SHOW = con("Prelude", "Show");
- public static final TCon EQ = con("Prelude", "Eq");
public static final TCon ORD = con("Prelude", "Ord");
- public static final TCon HASHABLE = con("Prelude", "Hashable");
public static final TCon IO = con("Serialization", "IO");
public static final Type REF = con("Prelude", "Ref");
public static final TUnion NO_EFFECTS = new TUnion();
public static final TCon PROC = con(BUILTIN, "Proc");
+ public static final TCon EXCEPTION = con(BUILTIN, "Exception");
public static final TCon BRANCH_POINT = con(BUILTIN, "BranchPoint");
+
+ public static final TCon CHRContext = con(BUILTIN, "CHRContext");
+
private volatile static TCon[] tupleCache = new TCon[] {
UNIT, null
}
};
-
+
public static boolean isPrimitive(Type type) {
return type == BOOLEAN || type == BYTE || type == CHARACTER || type == SHORT ||
type == INTEGER || type == LONG || type == FLOAT || type == DOUBLE || type == STRING;
parameters.add(Types.canonical(apply.parameter));
type = canonical(apply.function);
}
- return new MultiApply(type, parameters.toArray(new Type[parameters.size()]));
+ Type[] parametersArray;
+ if(parameters.isEmpty())
+ parametersArray = Type.EMPTY_ARRAY;
+ else {
+ parametersArray = new Type[parameters.size()];
+ for(int i=0,j=parametersArray.length-1;i<parametersArray.length;++i,--j)
+ parametersArray[i] = parameters.get(j);
+ }
+ return new MultiApply(type, parametersArray);
}
public static Type unifyApply(TCon func, Type type) throws MatchException {
return result;
}
+ public static TPred[] replace(TPred[] types, TVar[] from, Type[] to) {
+ if(types.length == 0)
+ return TPred.EMPTY_ARRAY;
+ TPred[] result = new TPred[types.length];
+ for(int i=0;i<types.length;++i)
+ result[i] = (TPred)types[i].replace(from, to);
+ return result;
+ }
+
public static <T extends Type> Type[] replace(Type[] types, THashMap<TVar, T> map) {
if(types.length == 0)
return Type.EMPTY_ARRAY;
else
return new TUnion(effects);
}
+
+ public static Type union(Type effect1, Type effect2) {
+ return new TUnion(effect1, effect2);
+ }
public static Type union(List<Type> effects) {
if(effects.size() == 0)