
Thank you for raising this issue, Christiaan! The current policy (very
early class-op inlining) is a major difficulty and the main source of
fragility in my compiling-to-categories implementation. I have a tediously
programmed and delicately balanced collection of techniques to intercept
and transform class ops to non-ops early and then transform back late for
elimination, but it doesn't work in all situations. Since class operations
roughly correspond to operations in various algebraic
abstractions---interfaces with laws---I often want to exploit exactly those
laws as rewrite rules, and yet those rules currently cannot be used
dependably. - Conal
On Fri, Mar 6, 2020 at 7:22 AM Christiaan Baaij
Hello,
The other day I was experimenting with RULES and got this warning:
src/Clash/Sized/Vector.hs:2159:11: warning: [-Winline-rule-shadowing] Rule "map Pack" may never fire because rule "Class op pack" for ‘pack’ might fire first Probable fix: add phase [n] or [~n] to the competing rule | 2159 | {-# RULES "map Pack" map pack = id #-}
The warning seems to suggests two things: 1. "Class op" -> "dictionary projection" are implemented as rewrite rules and executed the same way as other user-defined RULES 2. These rules run first, and you cannot run anything before them
Now my question is, is 1. actually true? or is that warning just a (white) lie? If 1. is actually true, would there be any objections to adding a "-1" phase: where RULES specified to start from phase "-1" onward fire before any of the Class op rules. I'm quite willing to implement the above if A) Class op rules are actually implemented as builtin RULES; B) there a no objections to this "-1" phase.
Thanks, Christiaan
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs