Skip to content

Draft: WIP TH support for JS Backend

Arjun Kathuria requested to merge arjun/ghc:wip/Th-js into wip/javascript-backend

WIP Template Haskell support for JS backend wrt issue #21078 (closed)

Hi, i've been slowly reading into how TH is implemented in both GHC and GHCjs

The fundamental difference seems to be that:-

  • GHC uses Binary serialized interpreted GHC Bytecode with message passing over pipes in case of -fexternal-interpreter flag (with their own message types, which assumes the remote interpreter is also a GHC) to implement the whole thing, meanwhile
    GHCJS seems to pass (what i assume to be JS code) binary serialized over stdin and stderr to an external node process.
  • Would we need a working JS FFI for this work first? (GHCJS seem to import code for sending and receiving messages from a JS file called runner.js initialized at compiler boot and wraps them over in haskell land).

To fashion the existing GHC message passing code to the new js passing would seem to branch it out pretty bad (is it bytecode or is it generated JS code being passed, is it haskell or is it JS ?).

wondering what should be the optimal way to move forward with this @hsyl20 @mpickering and where should i start looking/focusing/hacking to define the scope of this thing and probably get a Proof-of-concept kind of thing up & working. (currently reading up on implementation details on both sides, about TH in general, and the Quasi Typeclass and the functionality it captures)

Edited by Arjun Kathuria

Merge request reports