Rewrite rules

Joachim Breitner mail at joachim-breitner.de
Fri Jan 13 15:00:52 UTC 2017


Hi,

Am Freitag, den 13.01.2017, 20:27 +1100 schrieb Erik de Castro Lopo:
> Michael Snoyman wrote:
> 
> > Could be I'm misunderstanding, but are you looking for -ddump-rule-
> > firings?
> 
> Wasn't aware of that, but my question was a little more general.
> 
> If I write a library that includes rewrite rules, how can I ensure
> that they fire in client code that someone else writes? What
> guarantees (however loose) are there?

very little. The best one can do right now is to know enough about Core
and the inliner to predict when things are going to be inlined and when
not, what else can go wrong (wrappers maybe?), add the necessary
controls (`NOINLINE [0]` etc.), and then hope for the best. And track
down any instances of failed rewriting that you learn about.

You might also be able to set up your code so that it fails (at
runtime, with error) if the desired rules did not fire. This would be
nicer if we had https://ghc.haskell.org/trac/ghc/ticket/9180.

You can also ask for review if it is public code.

Greetings,
Joachim

-- 
Joachim “nomeata” Breitner
  mail at joachim-breitner.dehttps://www.joachim-breitner.de/
  XMPP: nomeata at joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F
  Debian Developer: nomeata at debian.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://mail.haskell.org/pipermail/glasgow-haskell-users/attachments/20170113/bea03570/attachment.sig>


More information about the Glasgow-haskell-users mailing list