Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BaseTransCFJava.trans: expected tuple type #189

Open
hy-zhang opened this issue Jun 3, 2015 · 1 comment
Open

BaseTransCFJava.trans: expected tuple type #189

hy-zhang opened this issue Jun 3, 2015 · 1 comment
Assignees

Comments

@hy-zhang
Copy link
Contributor

hy-zhang commented Jun 3, 2015

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 bixuanzju self-assigned this Jun 4, 2015
@bixuanzju
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants