Change-Id: I7068a4932be87afaa254cd9b1eecce712fb83d9c
addEffectConstructor("Proc", new EffectConstructor(Types.PROC));
addEffectConstructor("Exception", new EffectConstructor(Types.EXCEPTION));
addEffectConstructor("Proc", new EffectConstructor(Types.PROC));
addEffectConstructor("Exception", new EffectConstructor(Types.EXCEPTION));
+ addTypeAlias("Pure", TVar.EMPTY_ARRAY, Types.NO_EFFECTS);
+
//addTypeDescriptor("->", new StandardTypeConstructor(Kinds.STAR_TO_STAR_TO_STAR, Constants.FUNCTION));
addTypeDescriptor("[]", new StandardTypeConstructor(Types.LIST, Kinds.STAR_TO_STAR, Constants.LIST));
addTypeDescriptor("@", new StandardTypeConstructor(Types.PUNIT, Kinds.STAR, Constants.TUPLE[0]));
//addTypeDescriptor("->", new StandardTypeConstructor(Kinds.STAR_TO_STAR_TO_STAR, Constants.FUNCTION));
addTypeDescriptor("[]", new StandardTypeConstructor(Types.LIST, Kinds.STAR_TO_STAR, Constants.LIST));
addTypeDescriptor("@", new StandardTypeConstructor(Types.PUNIT, Kinds.STAR, Constants.TUPLE[0]));
this.parameters = new TVar[arity];
}
this.parameters = new TVar[arity];
}
+ public TypeAlias(TCon name, TVar[] parameters, Type body) {
+ super(name);
+ this.parameters = parameters;
+ this.body = body;
+ }
+
public int getArity() {
return parameters.length;
}
public int getArity() {
return parameters.length;
}
import org.simantics.scl.compiler.elaboration.chr.CHRRuleset;
import org.simantics.scl.compiler.elaboration.modules.Documentation;
import org.simantics.scl.compiler.elaboration.modules.SCLValue;
import org.simantics.scl.compiler.elaboration.chr.CHRRuleset;
import org.simantics.scl.compiler.elaboration.modules.Documentation;
import org.simantics.scl.compiler.elaboration.modules.SCLValue;
+import org.simantics.scl.compiler.elaboration.modules.TypeAlias;
import org.simantics.scl.compiler.elaboration.modules.TypeClass;
import org.simantics.scl.compiler.elaboration.modules.TypeClassInstance;
import org.simantics.scl.compiler.elaboration.modules.TypeDescriptor;
import org.simantics.scl.compiler.elaboration.modules.TypeClass;
import org.simantics.scl.compiler.elaboration.modules.TypeClassInstance;
import org.simantics.scl.compiler.elaboration.modules.TypeDescriptor;
import org.simantics.scl.compiler.module.debug.ModuleDebugInfo;
import org.simantics.scl.compiler.top.ModuleInitializer;
import org.simantics.scl.compiler.types.TCon;
import org.simantics.scl.compiler.module.debug.ModuleDebugInfo;
import org.simantics.scl.compiler.top.ModuleInitializer;
import org.simantics.scl.compiler.types.TCon;
+import org.simantics.scl.compiler.types.TVar;
+import org.simantics.scl.compiler.types.Type;
+import org.simantics.scl.compiler.types.Types;
import org.simantics.scl.runtime.profiling.BranchPoint;
import gnu.trove.map.hash.THashMap;
import org.simantics.scl.runtime.profiling.BranchPoint;
import gnu.trove.map.hash.THashMap;
return effectConstructors.put(name, effectConstructor) != null;
}
return effectConstructors.put(name, effectConstructor) != null;
}
+ public void addTypeAlias(String name, TVar[] parameters, Type body) {
+ typeDescriptors.put(name, new TypeAlias(Types.con(moduleName, name), parameters, body));
+ }
+
public boolean addTypeClass(String name, TypeClass typeClass) {
return typeClasses.put(name, typeClass) != null;
}
public boolean addTypeClass(String name, TypeClass typeClass) {
return typeClasses.put(name, typeClass) != null;
}