<div dir="auto">No. The part in quotes is the *name* of the rewrite rule, which is reported to the user when GHC is called with things like -ddump-rule-rewrites and is otherwise completely ignored.</div><div class="gmail_extra"><br><div class="gmail_quote">On Jan 16, 2017 4:09 AM, "Erik de Castro Lopo" <<a href="mailto:mle%2Bhs@mega-nerd.com">mle+hs@mega-nerd.com</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="quoted-text">Joachim Breitner wrote:<br>
<br>
> very little. The best one can do right now is to know enough about Core<br>
> and the inliner to predict when things are going to be inlined and when<br>
> not, what else can go wrong (wrappers maybe?), add the necessary<br>
> controls (`NOINLINE [0]` etc.), and then hope for the best. And track<br>
> down any instances of failed rewriting that you learn about.<br>
><br>
> You might also be able to set up your code so that it fails (at<br>
> runtime, with error) if the desired rules did not fire. This would be<br>
> nicer if we had <a href="https://ghc.haskell.org/trac/ghc/ticket/9180" rel="noreferrer" target="_blank">https://ghc.haskell.org/trac/<wbr>ghc/ticket/9180</a>.<br>
><br>
> You can also ask for review if it is public code.<br>
<br>
</div>Ok, I'm heading in this direction and then I figure out that the parser<br>
for the rewrite rules doesn't even reject obvious syntax errors.<br>
<br>
Say I have a data types:<br>
<br>
data Word128 = Word128 Word64 Word64<br>
<br>
and inspired by the `fromIntegral` rules for Word64 I write:<br>
<br>
{-# RULES<br>
"fromIntegral/Word64->Word128" fromIntegral = \w64 -> Word128 0 w64<br>
#-}<br>
<br>
all is fine and dandy. However if I introduce an obvious syntax error<br>
like reversing the `->`:<br>
<br>
{-# RULES<br>
"fromIntegral/Word64<-Word128" fromIntegral = \w64 -> Word128 0 w64<br>
#-}<br>
<br>
I don't get any warning or anything. I've read the docs for rewrite<br>
rules:<br>
<br>
<a href="https://downloads.haskell.org/~ghc/8.0.1/docs/html/users_guide/glasgow_exts.html#rewrite-rules" rel="noreferrer" target="_blank">https://downloads.haskell.org/<wbr>~ghc/8.0.1/docs/html/users_<wbr>guide/glasgow_exts.html#<wbr>rewrite-rules</a><br>
<br>
but they are rather sparse and again are very short on guarantees.<br>
<br>
Have I just managed to find myself a new project?<br>
<div class="elided-text"><br>
<br>
Erik<br>
--<br>
------------------------------<wbr>------------------------------<wbr>----------<br>
Erik de Castro Lopo<br>
<a href="http://www.mega-nerd.com/" rel="noreferrer" target="_blank">http://www.mega-nerd.com/</a><br>
______________________________<wbr>_________________<br>
Glasgow-haskell-users mailing list<br>
<a href="mailto:Glasgow-haskell-users@haskell.org">Glasgow-haskell-users@haskell.<wbr>org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/glasgow-<wbr>haskell-users</a><br>
</div></blockquote></div><br></div>