Making (useful subsets of) bytecode portable between targets

Shea Levy shea at
Mon Nov 21 12:50:44 UTC 2016

Hi all,

I'm interested in implementing a general solution for TH during
cross-compilation, which if my naive lack-of-understanding is correct
will broadly involve the following three tasks:

1. Make the generation of byte code, or at least the subset needed for
   useful TH use, target-independent
2. Teach the external-interpreter to launch a build-native iserv when
3. Teach cabal to compile dependencies and modules for the build and
   target when cross-compiling and TH is used

Of course, due to the generality of TH there will be code you can write
that would be different in this approach from what you would get with a
fully native compilation (e.g. due to GHC conditional compilation in the
TH functions or FFI that does runtime host introspection), but since
requiring a target device at build time is in many cases impractical (do
you want to hook up an iPhone to your build farm?) and in some cases
probably impossible (for targets without the resources to run a full GHC
even if they can run GHC-compiled code) I think this is a reasonable
restriction to require.

My questions to the list are:

* Is 1 above a pipe dream, keeping in mind that we are assuming the
  availability of build-native versions of all dependencies and
  already-compiled modules?
* Any pointers for getting started with 1?
* Anything I'm missing?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 800 bytes
Desc: not available
URL: <>

More information about the ghc-devs mailing list