ghc-9.6.3: The GHC API

Safe Haskell | Safe-Inferred
Language | Haskell2010

GHC.StgToJS.Sinker

Synopsis

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

# 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)