Actually that raises a question: is it possible to set a top level ghci option file pragma for having a module to fobject code ? That would be nice for exactly this reason. Fobject code doesn't seem to work as of 7.10, though it seems to be listed as dynamic as of 8.0 rc2, does that mean it'll work for those of using ghc 8.0 ??<br><br>On Wednesday, March 9, 2016, Ben Gamari <<a href="mailto:ben@well-typed.com">ben@well-typed.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Erik de Castro Lopo <<a href="javascript:;" onclick="_e(event, 'cvml', 'mle+hs@mega-nerd.com')">mle+hs@mega-nerd.com</a>> writes:<br>
<br>
> Hi all,<br>
><br>
> Recently Richard showed us how to load GHC into CHCi which ended up<br>
> being documented here:<br>
><br>
>     <a href="https://ghc.haskell.org/trac/ghc/wiki/Debugging/Compiler" target="_blank">https://ghc.haskell.org/trac/ghc/wiki/Debugging/Compiler</a><br>
><br>
> That very useful for some things, but doesn't give you access to<br>
> symbols and types that have not been exported.<br>
><br>
> Specifically, I'm interested in some of the inner workings of the<br>
> file `compiler/llvmGen/LlvmCodeGen.hs` and I've even managed to<br>
> load it into GHCi using the command line:<br>
><br>
>     inplace/bin/ghc-stage2 --interactive  -ignore-dot-ghci -fobject-code \<br>
>        -DSTAGE=1 -i -icompiler/basicTypes -icompiler/cmm -icompiler/codeGen \<br>
>       -icompiler/coreSyn -icompiler/deSugar -icompiler/ghci -icompiler/hsSyn \<br>
>       -icompiler/iface -icompiler/llvmGen -icompiler/main -icompiler/nativeGen \<br>
>       -icompiler/parser -icompiler/prelude -icompiler/profiling -icompiler/rename \<br>
>       -icompiler/simplCore -icompiler/simplStg -icompiler/specialise -icompiler/stgSyn \<br>
>       -icompiler/stranal -icompiler/typecheck -icompiler/types -icompiler/utils \<br>
>       -icompiler/vectorise -icompiler/stage1/build -icompiler/stage1/build/autogen \<br>
>       -Icompiler/stage1/build -Icompiler/stage1/build/autogen -Icompiler/.  \<br>
>       -Icompiler/parser -Icompiler/utils -Icompiler/stage1 -XHaskell2010 \<br>
>       compiler/llvmGen/LlvmCodeGen.hs<br>
><br>
> and it loads all the modules require, but then seems to mess up the symbol<br>
> table so that it can't even find top level functions in the module it has<br>
> just loaded.<br>
><br>
>     Prelude LlvmCodeGen> :t LlvmCodeGen.cmmDataLlvmGens<br>
><br>
>     <interactive>:1:1: error:<br>
>         Not in scope: ‘LlvmCodeGen.cmmDataLlvmGens’<br>
>         No module named ‘LlvmCodeGen’ is imported.<br>
><br>
> I even tied adding `-icompiler/llvmGen` to the above command line (from<br>
> hell) before I noticed that it was already present.<br>
><br>
The issue here is that you used -fobject-code while loading the module<br>
in question; this gives you only access to exported definitions.<br>
Unfortunately -fobject-code is necessary when loading GHC in GHCi as the<br>
bytecode interpreter doesn't support unboxed tuples, which various GHC<br>
modules use.<br>
<br>
I suspect it should be possible to convince GHCi to use object code for<br>
those modules which require it. In fact, I think thomie was looking into<br>
this at some point. I'm not sure what became of his effort.<br>
<br>
Cheers,<br>
<br>
- Ben<br>
<br>
<br>
</blockquote>