Cross-compiling Template Haskell via -fexternal-interpreter and IPC

Moritz Angermann moritz at
Thu Jul 7 00:57:18 UTC 2016

Great work Alberto,

I’m in favor of adding some form of network layer, as there are scenarios
where you have to run the th compilation process on a different machine.
This would be the case for iOS for example.

When I toyed with this ~2years ago, trying to port the out of process th
solution from ghcjs, I tried to use GHC’s plugin interface, to load the
module that would allow ghc to communicate with the runner on the device.

This in principle allows to have more dependencies on the plugin and not
force them into ghc. At the same time it requires the installation of some
additional hooks into the plugin system.

I guess one could also come up with a tiny proxy that pretends to be the
iserv endpoint and would forward anything over a network layer; this again
could probably work outside of ghc.


> On Jul 7, 2016, at 8:01 AM, Alberto Valverde <alberto at> wrote:
> Ben, Phyx,
> On Wed, Jul 6, 2016 at 7:14 PM, Ben Gamari <ben at> wrote:
> (...)
> Ahh, right. Out of curiosity what toolchain are you using to build your
> stage 1 cross compiler?
> I'm using an MXE ( environment in a Debian Jessie Docker image which has gcc-4.9.3. The build env is here:
> On Wed, Jul 6, 2016 at 7:14 PM, Ben Gamari <ben at> wrote:
> It would be nice if we could avoid it; GHC depending upon a library has
> the very unfortunate effect that any user code also needing to link
> against GHC or one of its libraries now has no choice in the version of
> that library. We go to some lengths to try to keep the dependency
> footprint of GHC small for this reason.
> (...)
> > Named pipes have also crossed my mind but I'm not sure how well they're
> > supported by wine.
> >
> It would be great if there were some way we could make this work with
> named pipes. Not only does it side-step the dependency issue, but it
> feels like the right way forward.
>  On Wed, Jul 6, 2016 at 8:05 PM, Phyx <lonetiger at> wrote:
> Named pipes would solve your issue, Just don't forget to set the proper ACL on the pipes.
> It does indeed work! However, I've broken GHC on a Windows host until I implement the equivalent to Posix.createNamedPipe since it seems there's no binding for CreateNamedPipe that I can find in the tree. I'll look into it tomorrow.
> I've pushed the changes so far to
> Thanks
> Alberto
> Cheers,
> - Ben
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at

More information about the ghc-devs mailing list