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

Minimize inferred type annotations #114

Open
joshsh opened this issue Nov 16, 2023 · 0 comments
Open

Minimize inferred type annotations #114

joshsh opened this issue Nov 16, 2023 · 0 comments

Comments

@joshsh
Copy link
Collaborator

joshsh commented Nov 16, 2023

Currently, Hydra's type inference infers, and stores as an annotation, a type not only for every element in a graph, but also for every subterm of every element. If you think of a term as a tree, every node in the tree bears a type annotation after type inference. Because every subterm has an annotation, we don't have to anticipate when the annotations will actually be needed, and when they will not. The Java coder, for example, relies much more heavily on type annotations than the Haskell coder does.

We could eliminate most of the overhead of computing, transforming, and storing these annotations if we simply provide a context-specific criterion for adding them. If the criterion evaluates to true, then we store an annotation. If not, then we don't. The Haskell coder only needs top-level annotations on elements, and nothing more. The Java coder additionally needs annotations on lambdas and other function terms, as well as in a few other places -- but it certainly doesn't need an annotation on every subterm. Type inference should be much faster after this is fixed.

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

No branches or pull requests

1 participant