Skip to content

Fixed runtime for WebAssembly/JavaScript #251

@HeinrichApfelmus

Description

@HeinrichApfelmus

Hi Lennart! I’m developing threepenny-gui, a GUI library in Haskell that uses the web browser as a display. My goal is to provide a GUI library in Haskell with an extremely low barrier to entry. I’m currently working on compiling to WebAssembly / JavaScript via MicroHs — this removes the need to run a native process (web server, containing the Haskell GUI logic).

In order to lower the barrier even further, I would like to ask for the following feature:

  • Currently, in order to compile a Haskell program to WebAssembly / JavaScript, users of my library would need to have Emscripten installed, which is called by mhs.
  • Instead, I want to compile the MicroHs C runtime once using Emscripten, and then have this fixed runtime be able to load “combinator bytecode” ("skicode" ?) dynamically. In this way, users of my library can use MicroHs to compile Haskell to combinator bytecode, but they do not need to have Emscripten installed, instead they hook up the bytecode with a predefined runtime.js file.

I suppose the main difficulty here is to accept combinator bytecode that calls foreign import javascript. This probably needs some form of combinator bytecode linker.

I managed to simplify the problem in that I only need a specific, fixed set of foreign import javascript in the runtime; I do other calls to JavaScript dynamically using eval() .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions