The GHC API doesn't provide a good hscTarget option for tooling
Tools like ghc-mod typically just want
TypecheckedModules. Sadly, the GHC API currently doesn't provide a good way to get at these in all cases (see this ghc-mod ticket). Each of the options we offer are cursed with their own limitations (largely quoting from the ghc-mod ticket),
At first glance this looks like what you would want. But...
* Doesn't generate code of any sort and is therefore rather lightweight
* It lacks support for Template Haskell
* Has trouble with
HscNothing doesn't work. Maybe
HscInterpreted is better?
* Supports Template Haskell
* Can't deal with unboxed tuples (#1257 (closed))
* Slower as we need to produce unnecessary bytecode
* Large memory footprint
* Also can't deal with
* Supports all compilable code
This is quite unfortunate. It seems like we need something in between
HscInterpreted which is willing to use the interpreter to evaluate Template Haskell splices when necessary, but doesn't produce bytecode. Unfortunately it's unclear what to do about
foreign export (but arguably most tools would be fine with some approximate representation).