Open acl-cqc opened 9 months ago
So, probably this is some kind of a wrapper around (a Hugr and some TypeParams), that one can validate
(-> calls Hugr::validate
passing in those TypeParams) and other things.
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 test_validate_with_closure
from #884
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. instantiate
a FuncDefn-rooted Hugr to a monomorphic, e.g. DFG-rooted, Hugr)
EDIT: there are two kind-of sub-issues here:
[TypeArg]
) across the nodes/body of the Hugr, rather than just the Type of a Hugr as we have now;[TypeArg]
toinsert_hugr
and other related methodsThis'll 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 of
USIZE_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.