public CompFunctionValue(FunctionValue f1, FunctionValue f2) { super(f1.location, AstFactory.newAFunctionType(f1.location, f1.type.getPartial() || f2.type.getPartial(), f2.type.getParameters(), f1.type.getResult()), "comp"); this.ff1 = f1; this.ff2 = f2; }
@Override public String caseAFunctionType(AFunctionType type) throws AnalysisException { List<PType> parameters = type.getParameters(); String params = parameters.isEmpty() ? "()" : Utils.listToString(parameters, " * "); return "(" + params + (type.getPartial() ? " -> " : " +> ") + type.getResult() + ")"; }
@Override public Boolean caseAFunctionType(AFunctionType type, Object other) throws AnalysisException { other = deBracket((PType) other); if (!(other instanceof AFunctionType)) { return false; } AFunctionType fo = (AFunctionType) other; return type.getPartial() == fo.getPartial() && type.getResult().apply(this, fo.getResult()) && af.createPTypeAssistant().equals(type.getParameters(), fo.getParameters()); }
@Override public PType caseAFunctionType(AFunctionType type, Context ctxt) throws AnalysisException { type = AstFactory.newAFunctionType(type.getLocation(), type.getPartial(), instantiate(type.getParameters(), ctxt), type.getResult().apply(this, ctxt)); type.setInstantiated(true); return type; }
type += " " + (functype.getPartial() ? "-" : "+") + "> " + functype.getResult().apply(typePrinter, question);
ff1.type.getPartial(), ff1.type.getParameters(), restrictedType.getResult()); ff2.type.getPartial(), restrictedType.getParameters(), ff2.type.getResult());