Search in sources :

Example 1 with Exp

use of catdata.fql.decl.SigExp.Exp in project fql by CategoricalData.

the class MapExpChecker method visit.

@Override
public Pair<SigExp, SigExp> visit(FQLProgram env, Curry e) {
    Pair<SigExp, SigExp> ft = e.f.accept(env, this);
    if (!(ft.first instanceof Times)) {
        throw new RuntimeException("Not a product: " + ft.first + " in " + e);
    }
    Times t = (Times) ft.first;
    return new Pair<>(t.a, new Exp(ft.second, t.b));
}
Also used : Times(catdata.fql.decl.SigExp.Times) Exp(catdata.fql.decl.SigExp.Exp) Pair(catdata.Pair)

Example 2 with Exp

use of catdata.fql.decl.SigExp.Exp in project fql by CategoricalData.

the class MapExpChecker method visit.

@Override
public Pair<SigExp, SigExp> visit(FQLProgram env, Apply e) {
    SigExp s = e.s.typeOf(env);
    SigExp t = e.t.typeOf(env);
    return new Pair<>(new Times(new Exp(s, t), t), s);
}
Also used : Times(catdata.fql.decl.SigExp.Times) Exp(catdata.fql.decl.SigExp.Exp) Pair(catdata.Pair)

Aggregations

Pair (catdata.Pair)2 Exp (catdata.fql.decl.SigExp.Exp)2 Times (catdata.fql.decl.SigExp.Times)2