BaseTransCFJava.trans: expected tuple type
Opened this issue · 1 comments
hy-zhang commented
type ExpAlg[E] = { lit : E };
type Exp = { accept : forall E. ExpAlg[E] -> E };
let merge[A, B] (x : ExpAlg[A]) (y : ExpAlg[B]) = {
lit = x.lit ,, y.lit
};
#let f1[A, B] (x : ExpAlg[A]) (y : ExpAlg[B]) (z : Exp) = z.accept[A & B](merge[A, B] x y);
let f2[A, B, C] (x : ExpAlg[A]) (y : ExpAlg[B]) (z : ExpAlg[C]) (w : Exp) =
w.accept[A & B & C](merge[A, B & C] x (merge[B, C] y z));
1
When I implemented the merge algebra by hand in source language, f2j complained that:
BaseTransCFJava.trans: expected tuple type
Seems that it only happens when both "ExpAlg" and "Exp" are record types. Not sure though.
bixuanzju commented
dumpsimplecore
of
type ExpAlg[E] = { lit : E };
type Exp = { accept : forall E. ExpAlg[E] -> E };
let merge[A, B] (x : ExpAlg[A]) (y : ExpAlg[B]) = {
lit = x.lit ,, y.lit
};
1
gives
...
let merge = /\ A -> /\ B -> \ (x : A) ->
\ (y : B) -> (_,_)
in
1
What is that underscore? We really need to polish pretty printer, otherwise it's hard for me to debug in backend.