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

Draft: Type inference for macros #229

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Draft: Type inference for macros #229

wants to merge 2 commits into from

Conversation

sheaf
Copy link
Collaborator

@sheaf sheaf commented Oct 18, 2024

This PR implements a simple type-inference pass for macros,
see HsBindgen.C.Tc.Macro. It implements a type system with:

  • variables
  • function types
  • type constructors
  • quantified types

Type inference for a macro function definition proceeds in the
following stages:

  1. constraint generation following Algorithm W, creating new
    metavariables and carrying a substitution,
  2. constraint solving: constraint simplification and defaulting
  3. quantification over remaining (undefaulted) type variables
    and remaining (unsolved) constraints.

@sheaf sheaf force-pushed the tc-macro branch 3 times, most recently from 6dd22c1 to 4ccab72 Compare October 21, 2024 14:22
This commit implements a simple type-inference pass for macros,
see HsBindgen.C.Tc.Macro. It implements a type system with:

  - variables
  - function types
  - type constructors
  - quantified types

Type inference for a macro function definition proceeds in the
following stages:

  1. constraint generation following Algorithm W, creating new
     metavariables and carrying a substitution,
  2. constraint solving: constraint simplification and defaulting
  3. quantification over remaining (undefaulted) type variables
     and remaining (unsolved) constraints.
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

Successfully merging this pull request may close these issues.

2 participants