Skip to content

CPR signatures for DataCon application bindings are redundant

If you look at interface files for e.g. ghc-prim:GHC.Types, you'll see that there are quite a few top-level bindings o type TyCon and KindRep, introduced for Typeable support. Attaching CPR signatures to each of them is quite wasteful.

In general, DataCon application bindings

  • Never get WW'd, so their CPR signature should be irrelevant after analysis (in fact the signature might even be harmful for that reason)
  • Would need to be inlined to see their CPR
  • Recording (Nested!) CPR on them blows up interface file sizes

But we can't just stop giving DataCon application bindings the CPR property, for example

  fac 0 = 1
  fac n = n * fac (n-1)

fac certainly has the CPR property and should be WW'd! But FloatOut will transform the first clause to

  lvl = 1
  fac 0 = lvl

If lvl doesn't have the CPR property, fac won't either.

So instead we should keep on looking through expandable unfoldings for these arity 0 bindings.

Edited by Sebastian Graf
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information