Right now im examining what load :: GhcMonad m => LoadHowMuch -> m SuccessFlag
does when freshly loading a target.
I reasoned with my brain until reaching its capacity. I couldn’t reason further after runPipeline'
returns.
I thought why not just modify the ghc source code with some traceM
sprinkling around, so i can peek into the intermediate value. Hence, i built ghc-9.2.8
following the guideline listed in gitlab. The building works smoothly with some adjustments(mainly, the ghc.nix uses ghc96
as bootghc, which causes ghc-9.2.8
's dependencies unable to fullfill)
However, it went wrong when evaluating the expression after loading ghc in ghci, following load ghc in ghci
I got the following error
Ok, 279 modules loaded.
ghci> :load GHC.Linker.Types
....loading
ghci> let t = uninitializedLoader
*** Exception: expectJust getLinkDeps
CallStack (from HasCallStack):
error, called at compiler/GHC/Data/Maybe.hs:70:27 in ghc:GHC.Data.Maybe
expectJust, called at compiler/GHC/Linker/Loader.hs:730:28 in ghc:GHC.Linker.Loader
I looked at some issues in gitlab, tried to duplicate the fix, but no success.Then i stumble upon the third bullet here. From my understanding, it’s not possible to evaluate ghc expression in ghci. Is it true?
If that’s the case, how ghc-as-lib people figure out what exactly each function does, other than creating a mental image with given prestate, and reason along?