This is still *very* kludgey, and it needs lots of work which I'm not
entirely prepared for, seeing as I really don't know anything about
the ghc-api and how things are supposed to fit together. It is quite
conceivable that the code could be simplified much further by someone who
actually understands the ghc-api, and there may be bugs related to the fact
that I don't actually know what some things do. However, this builds
and does appear to work. Most of the testsuite is passing.