interact package:ghc-lib-parser

The interact function takes a function of type String->String as its argument. The entire input from the standard input device is passed to this function as its argument, and the resulting string is output on the standard output device.
Built-in "bad" SrcLoc values for particular locations
Built-in "bad" SrcSpans for common sources of location uncertainty
Interactive context, recording information about the state of the context in which statements are executed in a GHCi session.
Switches in the DynFlags and Plugins from the InteractiveContext
A variant of runHsc that switches in the DynFlags and Plugins from the InteractiveContext before running the Hsc computation.
Constructs an empty InteractiveContext.
extendInteractiveContext is called with new TyThings recently defined to update the InteractiveContext to include them. By putting new things first, unqualified use will pick the most recently defined thing with a given name, while still keeping the old names in scope in their qualified form (Ghci1.foo).