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

[feature] constraint-based unification #111

Open
xieyuheng opened this issue Oct 7, 2022 · 5 comments
Open

[feature] constraint-based unification #111

xieyuheng opened this issue Oct 7, 2022 · 5 comments

Comments

@xieyuheng
Copy link
Member

xieyuheng commented Oct 7, 2022

  • pass test "check Cons -- my_cons -- constraint-based unification"
  • globals.cons
  • add test compute just cons
@xieyuheng
Copy link
Member Author

In the following example,

function my_cons(
  implicit A: Type,
  implicit B: (A) -> Type,
  x: A,
  y: B(x),
): exists (x: A) B(x) {
  return cons(x, y)
}

check my_cons("ratatouille", "baguette"): Pair(String, String)

during inferAp, we will meet:

unify B(x) = String

but only after the outer unification (during checkByInfer):

unfiy exists (x: A) B(x) = Pair(String, String)

We know:

{
  B: (_) => String
}

@xieyuheng
Copy link
Member Author

Solution 1:

During inferAp, save unify B(x) = String as a constraint.

@xieyuheng
Copy link
Member Author

xieyuheng commented Oct 7, 2022

I think this is called "constraint-based unification".

We might read some papers about this.

@xieyuheng xieyuheng changed the title [feature] constraint based unification [feature] constraint-based unification Oct 7, 2022
@xieyuheng
Copy link
Member Author

@ice1000
Copy link

ice1000 commented Oct 7, 2022

I think this is called "constraint-based unification".

Yes, it is :)

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

No branches or pull requests

2 participants