-
Notifications
You must be signed in to change notification settings - Fork 14
Closed
Description
SiblingSubgraph::create_simple_replacement
as well as SimpleReplacement::try_new
expect the type signature of the HUGR subgraph to match the type signature of the replacement DFG HUGR.
It would be useful to have a utility function that can reorder/copy/discard inputs and outputs of DFG graphs so that replacement graphs can be adjusted to match the subgraph signature.
Something like:
impl HugrView {
/// Change the function type of a DFG HUGR by reordering/copying/discarding
/// inputs and outputs of self.
///
/// Both `new_to_old_inputs` and `old_to_new_outputs` must be bijective when
/// restricted to the set of linear values.
fn change_function_type(
&self,
new_to_old_inputs: impl Fn(OutgoingPort) -> OutgoingPort,
old_to_new_outputs: impl Fn(IncomingPort) -> IncomingPort,
) -> Hugr {
}
}
Metadata
Metadata
Assignees
Labels
No labels