GHC as a library - getting output from GHCI

Simon Peyton-Jones simonpj at microsoft.com
Mon May 7 04:38:58 EDT 2007


| 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.

If you want to collect *all* the output, that presumably includes the output of printing to 'stdout'? That is, if I type
        putStr "Hello"
I see the result.

If you manage to redirect stdout in this way, I think you will also see the value of your 'stmt', because what GHC does is to compile a little (print it) stmt and run it.

It's a while since I looked at the Interactive loop, but I think that's right.


Simon



More information about the Glasgow-haskell-users mailing list