Is this the correct way to get Stg for a module?

Christopher Done chrisdone at
Fri Feb 15 12:30:48 UTC 2019

Hi all,

I'm attempting to get the Stg for a module with the intention of
interpreting it myself.

Here is a self-contained GHC-8.4.3-specific test-case to get STG:

I'm using the handy helpers GHC.parseModule, GHC.typecheckModule,
GHC.desugarModule to get the Core. For getting the STG I copied what
is done in HscMain.hs in GHC, right before it generates Cmm:

Can anyone confirm that the part I've highlighted in my Gist is the correct way
to get Stg? I can't really tell whether I missed anything or did
something wrong.


More information about the ghc-devs mailing list