A Haskell to WebAssembly compiler
Branch: master
Clone or download
Latest commit 43b6662 Feb 4, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci Do not use "ahc-link --bundle" for node.js targets Jan 7, 2019
.github Update to ghc-8.7.20181027 (+13 squashed commit) Oct 29, 2018
asterius Finalize the modularized rts work #50 (+53 squashed commit) Jan 7, 2019
binaryen Work around the lack of -M on macOS for ar (#55) Jan 11, 2019
docs Weekly report 190204 Feb 4, 2019
ghc-toolkit Finalize the modularized rts work #50 (+53 squashed commit) Jan 7, 2019
inline-js @ a1b472e bytestring support & numerous bugfixes and impovements Dec 9, 2018
npm-utils Finalize the modularized rts work #50 (+53 squashed commit) Jan 7, 2019
utils Simplify rts api & use v8 team's node build (+9 squashed commit) Dec 12, 2018
wabt Update wabt & binaryen, add SIMD opcodes for binaryen bindings Dec 15, 2018
wasm-toolkit bytestring support & numerous bugfixes and impovements Dec 9, 2018
.dockerignore bytestring support & numerous bugfixes and impovements Dec 9, 2018
.ghcid Finalize the modularized rts work #50 (+53 squashed commit) Jan 7, 2019
.gitignore Finalize the modularized rts work #50 (+53 squashed commit) Jan 7, 2019
.gitmodules bytestring support & numerous bugfixes and impovements Dec 9, 2018
Dockerfile Finalize the modularized rts work #50 (+53 squashed commit) Jan 7, 2019
README.md Add status reports. Dec 28, 2018
mkdocs.yml Add status reports. Dec 28, 2018
stack.yaml Fix CI breakage by outdated th-abstraction on head.hackage #52 Jan 13, 2019

README.md

Asterius: A Haskell to WebAssembly compiler

CircleCI Docker Pulls

A Haskell to WebAssembly compiler. Project status: alpha, in active development, some simple examples already work.

See the documentation for further instructions. Or check our blog posts:

Also, we've added Weekly Status Reports in case you're interested where the bleeding edge has reached.

Quick start

We provide pre-built Docker images. Put the input .hs program in a directory and map the directory to a Docker volume:

terrorjack@ubuntu:~$ docker run -it -v ~/mirror:/mirror terrorjack/asterius
root@76bcb511663d:~# cd /mirror
root@76bcb511663d:/mirror# ahc-link --help
...

See the help text of ahc-link for further instructions.

What works currently:

  • All GHC language features except Template Haskell.
  • Non-IO parts in ghc-prim/integer-simple/base/array/deepseq/containers/transformers/mtl/pretty/bytestring/binary/xhtml. IO is achieved via rts primitives like print_i64 or JavaScript FFI.
  • Fast arbitrary-precision Integer operations backed by BigInts.
  • Persistent "vault"s which are KV stores transferrable across asterius instances.
  • Importing JavaScript expressions via the foreign import javascript syntax. First-class JSVal type in Haskell land.
  • Fast conversion between Haskell/JavaScript types (strings, arrays and ArrayBuffers at the moment)
  • Calling Haskell functions from JavaScript via the foreign export javascript syntax. Haskell closures can be passed between Haskell/JavaScript boundary via StablePtr.
  • Invoking RTS API on the JavaScript side to manipulate Haskell closures and trigger evaluation.
  • A linker which performs aggressive dead-code elimination, producing as small WebAssembly binary as possible.
  • A debugger which checks invalid memory access and outputs memory loads/stores and control flow transfers.
  • Complete binaryen/wabt raw bindings, plus a monadic EDSL to construct WebAssembly code directly in Haskell.
  • A Haskell library to handle WebAssembly code, which already powers binary code generation.
  • Unit tests implementing stochastic fuzzer/shrinker for WebAssembly, in order to produce minimal repro in case something goes wrong in generated code.
  • Besides WebAssembly MVP and BigInt, no special requirements on the underlying JavaScript engine at the moment.

Better check the fib, jsffi, array, rtsapi and teletype test suites first to get some idea on current capabilities of asterius.

Sponsors

Asterius is maintained by Tweag I/O.

Have questions? Need help? Tweet at @tweagio.