Open jpfairbanks opened 1 month ago
A workaround that I found was to use the rule level predicates and an auxiliary function hastype
. My macro for specifying these uses the following to insert a call to hastype
which checks the symbolic type.
hastype(x, T) = symtype(x) == T
@rule $op(~x) => (hastype(~x,$src_type) ? $resolveto(~x) : nothing)
So the rules end up looking like
d(~x) => if hastype(~x, Form0)
d₀(~x)
else
nothing
end
but I'm not writing that verbosity because of an intermediate macro.
Just putting d(~x::Form0) in the LHS would be much more concise.
In trying to solve #629 with rewriting I came up with some rules:
Is there a way that we could hook into
@rule
so that if you tried to match on a type it automatically lifts that type to a predicate?