Class op rules
Carter Schonwald
carter.schonwald at gmail.com
Fri Mar 6 19:11:21 UTC 2020
so i did some poking around see eg
https://gitlab.haskell.org/ghc/ghc/blob/4898df1cc25132dc9e2599d4fa4e1bbc9423cda5/compiler/basicTypes/BasicTypes.hs#L1187-1207
, and at the moment, the simplifier phase number ordering internally (in
order from first to last)
"Initial phase" --- essentially positive infinity
.... -- currently we can add new phases here
2
1
0
-------
This actually surprised me, as i've always (at least from how rules are
usually written in eg vector) thought it was counting UP!
@Christiaan ... so we'd need a Pre initial phase count? that happens
before Initial phase?
On Fri, Mar 6, 2020 at 10:22 AM Christiaan Baaij <christiaan.baaij at gmail.com>
wrote:
> 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 at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20200306/7adc1ae5/attachment.html>
More information about the ghc-devs
mailing list