
Hrm. Have you considered using the ghc API? Ghci itself is written using it, and I imagine you could adapt that code for your purposes perhaps? On Sunday, January 5, 2014, Andrew Gibiansky wrote:
I cannot modify the Haskell code.
I am working on IHaskell - it is effectively a Haskell interpreter. It reads some code from the user, which may contain something like `getLine`. However, the frontend to the interpreter is not a shell but is a GUI in the web browser (IPython!). In order to do input, the interpreter sends a message to the frontend via the network saying "give me input", the frontend reads some input, and then sends things back.
In order to do this communication, I need to know when the getLine is called so that I know I need to send the message to the frontend.
Ideas? The thing is, getLine needs to not actually read from any shell - it will read from a pipe I create, and I simply need to know when to put stuff into that pipe.
-- Andrew