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
I have checked that there is no existing PR/issue about my proposal.
Summary
%transform rules should be run on CExp instead of Term, along with the other optimisations.
Motivation
Currently %transform rules are run on the core, rather than on CExp. This can make it fragile, since the lack eta-expansion and inlining can prevent rules from matching
The proposal
The %transform optimisation should be rewritten on CExp instead of Term. This might lead to more complexity, since CExp is more complex than Term, but it will make transform rules more reliable.
Examples
I have not managed to come up with a self-contained example yet, but while working on adding transform rules to prelude, I noticed the following fragility:
This definition allowed the rule to match:
Ord Nat where
compare x y = compareNat x y
But this didnt:
Ord Nat where
compare = compareNat
Technical implementation
N/A
Alternatives considered
Improve the current rewrite rule optimisation.
This may be complex, and will likely end up duplicating work, such as inlining and eta-expansion.
The text was updated successfully, but these errors were encountered:
Summary
%transform
rules should be run onCExp
instead ofTerm
, along with the other optimisations.Motivation
Currently
%transform
rules are run on the core, rather than onCExp
. This can make it fragile, since the lack eta-expansion and inlining can prevent rules from matchingThe proposal
The
%transform
optimisation should be rewritten onCExp
instead ofTerm
. This might lead to more complexity, sinceCExp
is more complex thanTerm
, but it will make transform rules more reliable.Examples
I have not managed to come up with a self-contained example yet, but while working on adding transform rules to prelude, I noticed the following fragility:
This definition allowed the rule to match:
But this didnt:
Technical implementation
N/A
Alternatives considered
Improve the current rewrite rule optimisation.
This may be complex, and will likely end up duplicating work, such as inlining and eta-expansion.
The text was updated successfully, but these errors were encountered: