Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'm putting this out here for discussion. My main question: how should I expose the hugr-like interface of
CircuitHistory
?. I've proposed an implementation ofHugrView
on a wrapper typeExperimentalHugrWrapper
of the circuit history. Seesrc/diff/experimental.rs
.A
CircuitHistory
is always equivalent to a valid Hugr (seeCircuitHistory::extract_hugr
), but implementingHugrView
is difficult becauseHugrInternals
is impossible. This could be implemented if the base hugr was node specific, i.e.fn base_hugr(&self, node: Node) -> &Hugr
hugr::Node
type is fixed, but in a CircuitHistory the "natural" node index is a pair(Hugr, Node)
, i.e. an index/ref to the correct hugr in the history, along with a node within it. Right now, I have "solved" this with the world's greatest hack, using the integer withinNode
to encode both a hugr index and the node index. This will overflow at2^16
which we are bound to reach pretty quicklyThere are still some minor TODOs, before this is mergeable (if we wish to merge it)
history::test_history
testapply_rewrite
toCircuitHistory