<div dir="ltr">Also I should add that this is probably not just happening for ids mentioned by RULEs, but also for Unfoldings. E.g. although wrappers are exported, associated workers are not, but still visible through unfoldings. It's not as bad as with RULEs since they are still reachable, but it might make for weird results... And also contradicts <span style="font-size:12.8px">Note [ExportFlag on binders] in Var.hs as I understand it.</span></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 29, 2017 at 10:40 AM, Sebastian Graf <span dir="ltr"><<a href="mailto:sgraf1337@gmail.com" target="_blank">sgraf1337@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">OK, I attached an example for a specialization of Show for a special case of a custom type, like Ratio in <a href="https://hackage.haskell.org/package/base-4.9.1.0/docs/src/GHC.Real.html" target="_blank">GHC.Real</a>. My invokation with a custom GHC (8.0-based) was like this:<div><br></div><div>    $ <ghc> Module.hs -ddump-simpl -O -fforce-recomp<br></div><div><br></div><div>At the begin of the log, I listed all exported top-level identifiers, the only interesting of which is `$fShowRatio :: Show a => Show (Ratio a)`, the default implementation. Note that at the bottom, there are RULEs stating the specialization for `Show Integer`, but that the specialized dictionary `$fShowRatio_$s$fShowRatio :: Show (Ratio Integer)` isn't otherwise reachable from any exported top-level identifier. Same goes for any of the specialized dictionary methods.</div><div><br></div><div>Now consider what happens if we request a `Show (Ratio Integer)` dictionary in another module: GHC finds the exported default dictionary `$fShowRatio :: Show a => Show (Ratio a)`, but then applies a specialization RULE that will effectively use the presumably absent `$fShowRatio_$s$fShowRatio :: Show (Ratio Integer)`.</div><div><br></div><div>In my case, my custom GHC would substitute away the `showString " % "` for an `absentError "lvl [Char]"` and crash in subtle ways. The only reason this isn't happening for GHC master is that DmdAnal does consider all top-level arguments to be used, instead of only the exported ones (which is what CallArity does).</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Sun, May 28, 2017 at 11:53 PM, Sebastian Graf <span dir="ltr"><<a href="mailto:sgraf1337@gmail.com" target="_blank">sgraf1337@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"><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">welcome on this list!</blockquote><div><br></div><div>Thanks :)</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">     isExportedId :: Var -> Bool</blockquote><div><br></div><div>That's what I have been using so far, but I found that said RULE pragmas mentioned non-exported identifiers. Or maybe it was just some temporary build system mess-up, I'll work on a reproduction...</div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="m_-1340863217247968545h5">On Sun, May 28, 2017 at 10:33 PM, Joachim Breitner <span dir="ltr"><<a href="mailto:mail@joachim-breitner.de" target="_blank">mail@joachim-breitner.de</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div class="m_-1340863217247968545h5">Hi Sebastian,<br>
<br>
welcome on this list!<br>
<span class="m_-1340863217247968545m_-8651003887547175895gmail-"><br>
Am Sonntag, den 28.05.2017, 17:52 +0200 schrieb Sebastian Graf:<br>
> Is there some function that tells me if an identifier is 'externally<br>
> visible' in that sense? I think <a href="https://downloads.haskell.org/~ghc/8" rel="noreferrer" target="_blank">https://downloads.haskel<wbr>l.org/~ghc/8</a>.<br>
> 0.1/docs/html/libraries/ghc-8.<wbr>0.1/GHC.html#v:isExternalName is what<br>
> I'm after, but I want to be sure. Does that function already work<br>
> when the Ids are still local?<br>
<br>
</span>I would expect<br>
<br>
    isExportedId :: Var -> Bool<br>
<br>
to do precisely that.<br>
<br>
Greetings,<br>
Joachim<br>
<span class="m_-1340863217247968545m_-8651003887547175895gmail-HOEnZb"><font color="#888888"><br>
--<br>
Joachim “nomeata” Breitner<br>
  <a href="mailto:mail@joachim-breitner.de" target="_blank">mail@joachim-breitner.de</a> • <a href="https://www.joachim-breitner.de/" rel="noreferrer" target="_blank">https://www.joachim-breitner.d<wbr>e/</a><br>
  XMPP: <a href="mailto:nomeata@joachim-breitner.de" target="_blank">nomeata@joachim-breitner.de</a> • OpenPGP-Key: 0xF0FBF51F<br>
  Debian Developer: <a href="mailto:nomeata@debian.org" target="_blank">nomeata@debian.org</a></font></span><br></div></div>______________________________<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></blockquote></div><br></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>