
Johannes Waldmann wrote:
The following program prints Right ("test","Bool","True") as it should, but it leaves behind in /tmp two files (name is a long string of digits) and an empty directory (name is ghcNNNNN_N).
I have a partial solutions for this; see the attached patch for hint. It cleans up the numbered files, which are generated for "phantom modules". There are two phantom modules generated -- one that defines a _show function for hint's internal use, and one that provides a bunch of pre-imported modules for mueval. The latter will not be generated if the 'modules' mueval option is set to Nothing. For some reason, cleaning the ghc* directory fails if the executed code fails (for example, using 'test = undefined' in Johannes' code). Can anybody explain why? The `finally` handler is run, and the phantom module files are actually deleted.
... and it deletes the input file (/tmp/Main.hs).
That appears to be an undocumented mueval feature. It's not a good one, I think.
That's not nice. Ideally, I would want to read input from a String (instead of the file), and not write to disk at all.
I suppose that ghc's interface does not support this, but I have not checked. Best regards, Bertram