
The only problem I see with that is that error message locations will be a bit off, since the file being compiled is different from the file submitted. But since we're in the hacks territory anyway, this could be fixed up with a simple regex :-)
... or line pragmas :-) I'm currently investigating another route though. I wrote a simple program which parses some Haskell files with "haskell-src-exts" (we actually even need "hse-cpp"), builds a graph with all known dependencies, uses "topSort" from "Data.Graph" to come up with a proper ordering and prints the source files in that order. That approach feels a lot safer to me. It can be used like: ghc -c $(cabal exec topoSort "${files[@]}") (Never mind the obvious unsafe file name handling.) The downside is that parse errors won't be reported by GHC, but by our preprocessing tool. (I've attached the tool, but keep in mind it's just a quick proof of concept.) Cheers Lars