Allow using targetContents for modules needing preprocessing
This changeset allows GHC API clients, most notably tooling such as Haskell-IDE-Engine, to pass unsaved files to GHC more easily.
Currently when targetContents
is used but the module requires preprocessing
preprocessFile
simply throws an error because the pipeline does not
support passing a buffer.
This change extends runPipeline
to allow passing the input buffer into
the pipeline. Before proceeding with the actual pipeline loop the input
buffer is immediately written out to a new tempfile.
I briefly considered refactoring the pipeline at large to pass around in-memory buffers instead of files, but this seems needlessly complicated since no pipeline stages other than Hsc could really support this at the moment.
This MR is part of my GSoC19 project A stronger foundation for interactive Haskell tooling, specifically Task 1.1 in my proposal (pdf).