naively, I'd imagine one part of the challenge is that Template haskell induces needing a ghc that can build libraries for *BOTH* host and target, because we have arbitrary execution at Template Haskell time, right?
So does that mean fixing up GHC's architecture so that it can be built with support for more than 1 target? (or at least running libs on *host* in GHCI but otherwise compiling them for target? )
What would be needed in the restricted case of "We just want TH for our cross compiler" rather than "general multi target goodness"?
Because If I squint, it sort of sounds like the cross compiler would need to be Stage 2, and that the UNsound but simplest approach would then be to take the various "libways", and produce both host and target variants as appropriate (or that "build HOST Way" has to explicitly flagged). I"m not sure what implications this or another approach would have on all the various build tooling needed etc etc.
This is me just thinking out loud / trying to understand *why* and whats needed, and how complex the work would be to do it well, or at least decently in a way that *improves* (or doesn't complicate much more) the associated parts that would need to be fixed up.
Basically: whats needed to make cross compiler GHC first class haskell wrt TH support? (I imagine that its not worth working on till the new TH work lands / stabilizes, but id like to understand what work has to be done to lead up to it).
(if I can figure out ways I can directly or indirectly support such work happening, subject to having the time and/or resources over the next year, i'd like to try and do so)
-Carter