ghc-9.6.0.20230210: The GHC API
Safe HaskellSafe-Inferred
LanguageHaskell2010

GHC.StgToJS.Sinker

Synopsis

Documentation

sinkPgm :: Module -> [CgStgTopBinding] -> (UniqFM Id CgStgExpr, [CgStgTopBinding]) Source #

Unfloat some top-level unexported things

GHC floats constants to the top level. This is fine in native code, but with JS they occupy some global variable name. We can unfloat some unexported things:

  • global constructors, as long as they're referenced only once by another global constructor and are not in a recursive binding group
  • literals (small literals may also be sunk if they are used more than once)