Asterius: A Haskell to WebAssembly compiler
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:
- Fibonacci compiles end-to-end: Haskell to WebAssembly via GHC
- Asterius GHC WebAssembly backend reaches TodoMVC
Also, we've added Weekly Status Reports in case you're interested where the bleeding edge has reached.
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 --input-hs xxx.hs ...
See the help text of
ahc-link for further instructions.
What works currently:
- All GHC language features except Template Haskell.
- Non-IO parts in
xhtml. IO is achieved via rts primitives like
- Fast arbitrary-precision
Integeroperations backed by
- Preliminary Cabal support.
JSValtype in Haskell land.
- 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.
wabtraw 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
ahc-linkdocumentation page for details.
Building from source
install the following:
nodejs12.x. Binaries can be downloaded from
and then follow the commands in the
For hacking instructions, there is a
docs/hacking.md which has advice and common commands
Asterius is maintained by Tweag I/O.
Have questions? Need help? Tweet at @tweagio.