GHC as a library - getting output from GHCI

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


Hi

I am trying to use GHC as a library (see
http://haskell.org/haskellwiki/GHC/As_a_library ). I want to get all the
output from an interactive session and put in a GUI. This
http://haskell.org/sitewiki/images/5/51/Interactive.hs 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?


Greetings,

Mads Lindstrøm



More information about the Glasgow-haskell-users mailing list