ghc-api

Evaluation of Haskell Statements/Expressions using GHC API

For a tool I'm writing ( http://hackage.haskell.org/package/explore ) I need a way to read haskell function definitions at run-time, apply them to values from my tool and retrieve the results of their application. Can anyone give me a very basic example using GHC (6.10.4 or 6.12.1) API? example function definition to be read from a fil...

Is it possible to use the GHC API to modify a program while compiling it?

I want to test the implementation a compiler optimization by piggybacking into the GHC compilation process and altering its Core representation. The idea would be to have something like: runGhc (Just libdir) $ do ... c <- compileToCoreModule targetFile compileCoreToObj False (modify c) ... where modify takes the Core repre...