AsteriusでHaskellの関数をJSから呼べるようにしてみた(けど失敗)

Yuji Yamamoto (山本悠滋)

2019-04-19 Emscripten & WebAssembly night !! #7

はじめまして! (^-^)

宣伝 hask(_ _)eller

Topics and Summary

※From this slide, written in English to show the developer of Asterius.

🔍What Asterius is:

👍Asterius’s Pros

👍Asterius’s Pros (cont)

👎Asterius’s Cons

👎Asterius’s Cons (cont)

⚙️How Asterius works

Ref: IR types and transformation passes

  1. Wrap the fork of GHC with a frontend plugin:
    • Convert .cmm files to AsteriusModule (custom object format for Asterius).
  2. ahc-ld (dedicated linker) links for WASM.

⚙️How Asterius works (cont)

  1. ahc-dist makes it executable.
    • With binaryen or wasm-toolkit, validate and convert the modules to WASM module.
    • Copy JavaScript modules required at runtime.
    • Emit the entry JavaScript module to run the main function of the source Haskell file.

How I tried to run my function with Asterius

The target app:

How I tried to run my function with Asterius (cont)

🔥I had to drop some dependent packages to compile my code…

How I tried to run my function with Asterius (cont)

Result

✅Summary