runstmt within API

C.M.Brown cmb21 at kent.ac.uk
Wed Apr 23 06:41:13 EDT 2008


Hello,

I want to use the ghc evaluator on the fly for some refactorings within
HaRe. However, I notice that runstmt ::Session -> String -> IO RunResult.

Is there anyway I can grab the result of the evaluated expression as a
String (rather than it being outputted to the terminal)?

It seems RunResult is defined:

data RunResult
    = RunOk [Name]    -- names bound by the expression
    | RunFailed
    | RunException GHC.IOBase.Exception

If I can't grab its result, is there a way to query the [Name] to get a
list of bindings in String format? Preferably something like
"it = expression".

Kind regards,
Chris.



More information about the Glasgow-haskell-users mailing list