[GHC API] How to retrieve the result of a statement evaluation ?

Alain Cremieux alcremi at pobox.com
Thu Oct 13 23:28:11 CEST 2011

I am trying to move to GHC 7.2.1, and have problems replacing 'hint', 
which is not available anymore (and is overkill for what I need to do).
So I decided to use GHC API instead, but I can't make it work exactly as 
I'd like.
I need to evaluate simple statements, like
["xx" ++ show i | i <- [1..3]]

I use something like :  res <- runStmt src RunToCompletion
(after loading the Prelude, and putting the statement in the String 
src), but it prints (correctly) the result, and I don't find a way to 
retrieve it in my program. The variable 'it' is bound, but I can't get 
its value.
Am I missing something obvious ? Should I redirect the output somewhere, 
and how ?


More information about the Glasgow-haskell-users mailing list