use of catdata.fql.decl.SigExp.Times in project fql by CategoricalData.
the class MapExpChecker method visit.
@Override
public Pair<SigExp, SigExp> visit(FQLProgram env, Prod e) {
List<String> l = new LinkedList<>(seen);
Pair<SigExp, SigExp> lt = e.l.accept(env, this);
seen = l;
Pair<SigExp, SigExp> rt = e.r.accept(env, this);
seen = l;
if (!lt.first.equals(rt.first)) {
throw new RuntimeException("source schema mismatch on " + e + ": " + lt.first + " and " + rt.first);
}
return new Pair<>(lt.first, new Times(lt.second, rt.second));
}
use of catdata.fql.decl.SigExp.Times in project fql by CategoricalData.
the class MapExpChecker method visit.
@Override
public Pair<SigExp, SigExp> visit(FQLProgram env, Dist1 e) {
SigExp aa = e.a.typeOf(env);
SigExp bb = e.b.typeOf(env);
SigExp cc = e.c.typeOf(env);
return new Pair<>(new Times(aa, new Plus(bb, cc)), new Plus(new Times(aa, bb), new Times(aa, cc)));
}
use of catdata.fql.decl.SigExp.Times in project fql by CategoricalData.
the class MapExpChecker method visit.
@Override
public Pair<SigExp, SigExp> visit(FQLProgram env, Fst e) {
SigExp a = e.s.typeOf(env);
SigExp b = e.t.typeOf(env);
return new Pair<>(new Times(a, b), a);
}
use of catdata.fql.decl.SigExp.Times 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));
}
use of catdata.fql.decl.SigExp.Times 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);
}
Aggregations