Have GHCi automatically use -fobject-code for modules that use UnboxedTuples
This is related to a relatively old issue, that the bytecode interpreter cannot handle UnboxedTuples: #1257 (closed) . Rather than fix that issue, which sounds quite challenging, how about adding some automagic to GHCi which builds object code for modules that use UnboxedTuples?
This is a bit trickier than just compiling those modules to object code, because object code cannot be linked against byte code (see #10965 (closed)). A potential solution to this is to also build all of the dependencies of modules that use UnboxedTuples using object code.
This idea has some precedent, though as an external script - see #13101 and https://gist.github.com/bgamari/bd53e4fd6f3323599387ffc7b11d1a1e . I think it would be best to put the solution to this directly in GHCi. What do you think? If y'all think it is a good idea, then I can volunteer to try to make it happen.
As described in that ticket, this would be particularly helpful for loading GHC into GHCi, because GHC's code uses UnboxedTuples. Currently,
-fobject-code must be used, which means that the speedup from using GHCi isn't quite as much as it could be. It is possible to get around this by first loading it with object code and then doing another load without object code, but that's rather inconvenient.
Since this may be a surprising behavior change (the user may not have specified -odir and -hidir), it could possibly be enabled via a flag.