You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently Rewrite bakes in the types that it can apply to as HugrMut. This means we cannot generalise Rewrite to H: HugrView<Node = N> where N$\neq $Node (as introduced by #1932).
It also makes it impossible to implement this trait on any persistent data structure.
Proposal
We add a generic Subject type that specifies on what types the Rewrite can be applied.
Do you mean this instead for the current rewrites? Note that that doesn't restrict running verify and apply on the same type.
Yes, sorry, corrected the type signature. I don't think the associate type approach would work, you definitely want most rewrites to apply to any H: HugrMut.
You are right that you could use what are effectively different impls to run verify and satisfy on different types. This is nevertheless still strictly weaker than the current API, which guarantees that you can call verify on any HugrView.
Currently$\neq $
Rewrite
bakes in the types that it canapply
to asHugrMut
. This means we cannot generaliseRewrite
toH: HugrView<Node = N>
whereN
Node
(as introduced by #1932).It also makes it impossible to implement this trait on any persistent data structure.
Proposal
We add a generic
Subject
type that specifies on what types the Rewrite can be applied.All current impls would then look as follows
Drawbacks
verify
andapply
to act on the same type (whereas the current version ofverify
accepts anyHugrView
)Thoughts?
The text was updated successfully, but these errors were encountered: