GHC as a library - getting output from GHCI

Mads Lindstrøm mads_lindstroem at
Fri May 4 12:04:38 EDT 2007


I am trying to use GHC as a library (see ). I want to get all the
output from an interactive session and put in a GUI. This seemed to be a
nice starting point.

However, the result of:

GHC.runStmt session stmt

does not include the output of evaluating the statement (stmt above) -
just the names of bound names. That is if stmt eqauls "3 + 5" then
GHC.runStmt do not return a string equaling "8", but just the "it"-name
(which is bound to 8).

The output is printed to standard output :( And I do not see and easy
way to get hold of it. The only way I see, is having the GUI in one
process and "GHC as a library" in another process.

Do anybody know of an easy way to get hold of the output from "GHC as a
library" - the output currently printed to standard output?


Mads Lindstrøm

More information about the Glasgow-haskell-users mailing list