title: How to spawn ghci and pass a pointer to it where it can access later?
body: <p>In my haskell program I invoke ghci via <code>createProcess</code> in System.Process module. I want to run some initialization code in ghci before entering in a forever loop which gets user input and passes to ghci for evaluation. One of the value is a <code>Ptr a</code> which is created using FFI from c code. Another is a function which is imported from shared lib which needs the pointer to do all useful stuffs. I can "create" this function directly in ghci or make ghci load a module file, but the pointer is the key problem.</p>
  
  <p>That pointer actually points to a large struct and is volatile. Ideally to make it works ghci should be able to access the memory at any time. I'm not familiar with Linux process and don't know if it's possible in this scenario. Or is there any better way to achieve the same effect? (create a repl environment with additional helper functions ready for the user to use interactively)</p>
  
  <p>I prefer not to write my own repl code and not use hint.</p>