-
Notifications
You must be signed in to change notification settings - Fork 8
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
Polymorphic top-level Hugrs #709
Comments
So, probably this is some kind of a wrapper around (a Hugr and some TypeParams), that one can
|
This'll also give us a way to do inference separately for subgraphs and thus a better solution to inserting a subgraph than that of |
It is just possible that maybe we could treat FuncDefn as the only binder with TypeParams. We would still need a method to apply a substitution across the Hugr (i.e. |
Preliminary: note #1733 added the ability to
substitute
across the nodes/body of the Hugr, rather than just the Types of a Hugr; and #1934 applies this across a subtree copied from a polymorphic funcdefn to a monomorphic callsite.Here we want a standalone structure of a Hugr+TypeParams, with a
validate
method (and maybe other Hugr(View/Mut)-like methods), i.e. calling some newHugr::validate_with_type_params
(andHugr::validate
just calls that with the empty list).Maybe also a method that "instantiates" it to just a Hugr.
This
will(EDIT: might!) be useful for #978; in time for compilation/lowering (by template-extension, rather than type-erasure/interpretation à la Tierkreis/JVM); it offers new Hugr-construction methods (alluded to in #457); it potentially simplifies tests (which could use a type variable instead of pulling in some extension just to give a concrete leaf type - although use ofUSIZE_T
is widespread enough we barely notice).If we store binders separately from the Hugr nodes, then we need to be careful about additional variables bound by FuncDefn nodes, i.e. can these still see the outer binders? If so, we have a limited return of DeBruijn indices, and will probably need to pass a second
&[TypeParam]
aroundvalidate_subtree
(and a first intovalidate
) etc. So perhaps maintain that the outer TypeParams are not visible inside any inner FuncDefns.The text was updated successfully, but these errors were encountered: