<div dir="ltr">If what you say is true then I think I have some holes in my understanding of TH. Aren't AST splices, by definition, just generated Haskell source code? Isn't the whole idea that TH produces source code as if a programmer wrote it in the first place? How is this platform dependent?<div><br></div><div>My understanding of Template Haskell was that something like the following happened:</div><div><br></div><div>1. Code generating functions in a module (call it module M) are compiled to an object file.</div><div>2. A modules, call it P, that wishes generate code imports module M and runs this code at compile time.</div><div><br></div><div>But as far as I can tell this only generates *source code*. P then needs to be compiled to object code.</div><div><br></div><div>The problem in the cross compiler situation is that the dynamic linker can't load the code in M.o</div><div>since that has been compiled for the target machine, not the host.</div><div><br></div><div>Apart from that though, I don't see what is platform specific about the code *generated* in module P by the functions imported from module M. It's just source code isn't it? Not object code.</div><div><br></div><div><br></div><div><br></div><div>Sean</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 9 December 2014 at 22:02, Brandon Allbery <span dir="ltr"><<a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><span class=""><div class="gmail_quote">On Tue, Dec 9, 2014 at 5:27 AM, Sean Seefried <span dir="ltr"><<a href="mailto:sean.seefried@gmail.com" target="_blank">sean.seefried@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>If the bytecode could be made</div><div>to be platform independent -- and I know this would be a *lot* of work -- then we'd have a pretty good solution for Template Haskell with cross compilers, wouldn't we?</div></blockquote></div><br></span><div>I think you're missing the point a bit; such a setup would work for runghc, but TH needs to be aware of both the host (in this case that'd be a platform-independent VM bytecode) and the target (since it is generating AST splices for a specific target). The latter is much harder than the former.</div><span class=""><div><br></div>-- <br><div><div dir="ltr"><div>brandon s allbery kf8nh                               sine nomine associates</div><div><a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a>                                  <a href="mailto:ballbery@sinenomine.net" target="_blank">ballbery@sinenomine.net</a></div><div>unix, openafs, kerberos, infrastructure, xmonad        <a href="http://sinenomine.net" target="_blank">http://sinenomine.net</a></div></div></div>
</span></div></div>
</blockquote></div><br></div>