<div dir="ltr">My understanding was that they ought to be the same.  However, that didn't seem to be the case.  In my small example, where the plugin did work, -fexpose-all-unfoldings did not.</div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Oct 30, 2016 at 8:23 AM, Christiaan Baaij <span dir="ltr"><<a href="mailto:christiaan.baaij@gmail.com" target="_blank">christiaan.baaij@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">One small question: what's the difference between adding INLINABLE everywhere, and just compiling with -fexpose-all-unfoldings, <a href="https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/using-optimisation.html#ghc-flag--fexpose-all-unfoldings" target="_blank">https://downloads.haskell.org/<wbr>~ghc/latest/docs/html/users_<wbr>guide/using-optimisation.html#<wbr>ghc-flag--fexpose-all-<wbr>unfoldings</a>? Is there any reason you couldn't use that flag as opposed to writing a plugin that adds INLINEABLE pragmas to all bindings?</div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On 28 October 2016 at 00:05, Ryan Trinkle <span dir="ltr"><<a href="mailto:ryan.trinkle@gmail.com" target="_blank">ryan.trinkle@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Hi everyone,<div><br></div><div>I'm trying my hand at writing a GHC plugin to generate specializations for all uses of a particular typeclass, and I've run into some trouble.  I'd appreciate it if someone could point me in the right direction!  I'm new to GHC development, so I may just be overlooking some simple stuff.</div><div><br></div><div>The original problem:</div><div>Reflex's interface is presented as a typeclass, which allows the underlying FRP engine to be selected by instance resolution.  Although some programs make use of this (particularly the semantics test suite), most only ever use one implementation.  However, since their code is typically written polymorphically, the implementation cannot be inlined and its rewrite rules cannot fire.  This means that the typeclass </div><div><br></div><div>My attempted solutions:</div><div> * Initially, I wrote a plugin that adds INLINABLE pragmas to everything.  This helped; small programs now generally see the inlining/rule-firings I was hoping for.  However, in large programs, this does not occur.  I'm looking into this, but also trying another approach:</div><div> * Now, I am attempting to write a plugin that adds a SPECIALIZE pragma to every binding whose type mentions Reflex.</div><div><br></div><div>The trouble:</div><div>Since SPECIALIZE pragmas seem to be removed during typechecking (DsBinds.dsSpec), I can't directly add them.  I would like to, perhaps, invoke Specialise.specBind; however, I'm not sure how to obtain the necessary instance - as mentioned <a href="https://github.com/ghc/ghc/blob/c36904d66f30d4386a231ce365a056962a881767/compiler/specialise/Specialise.hs#L288" target="_blank">here</a>, "only the type checker can conjure [dictionaries] up".  Perhaps it's possible to explicitly create that dictionary somewhere and extract it for use during the plugin pass?</div><div><br></div><div><br></div><div>Thanks,</div><div>Ryan</div></div>
<br></div></div><span class="">______________________________<wbr>_________________<br>
ghc-devs mailing list<br>
<a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bi<wbr>n/mailman/listinfo/ghc-devs</a><br>
<br></span></blockquote></div><br></div>
<br>______________________________<wbr>_________________<br>
ghc-devs mailing list<br>
<a href="mailto:ghc-devs@haskell.org">ghc-devs@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/ghc-devs</a><br>
<br></blockquote></div><br></div>