Finding out if a binding is externally visible

Joachim Breitner mail at
Mon May 29 17:33:08 UTC 2017


Am Montag, den 29.05.2017, 17:28 +0200 schrieb Sebastian Graf:
> > Occurrence Analyzer
> Ahh, good thinking. 
> Do Unfoldings qualify in the same way?

Unfoldings are kept alive together with the thing they unfold (so that
you can remove an unfolding together with its Id should that get
unused). And for most analyses, it makes sense to consider them an
alternative RHS, so if you have

f [Unfolding = \x -> bar x]
f = \x -> foo x

then that is a bit like

f x = case coinToss of True -> bar x
                       False -> foo x

> So, what binders do I have to consider as 'roots' apart from exports,
> RULEs, VECTORISE and possibly Unfoldings? That should be pretty much
> everything relevant, if the occurence analyser gets away with it,
> right?

If the occurence analyser gets away with it, then so do you :-)

But Unfoldings are not roots; they are referenced by the ID they

(I wonder if the same can be said for non-orphan RULES, but maybe that
is just too much a corner case.)


Joachim “nomeata” Breitner
  mail at joachim-breitner.de
  XMPP: nomeata at • OpenPGP-Key: 0xF0FBF51F
  Debian Developer: nomeata at
-------------- 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: <>

More information about the ghc-devs mailing list