1
1
mirror of https://github.com/tweag/asterius.git synced 2024-09-11 08:55:32 +03:00
A Haskell to WebAssembly compiler
Go to file
2020-08-11 15:34:08 +02:00
.buildkite Use GitHub Actions for regular CI (#668) 2020-05-31 20:58:51 +02:00
.devcontainer Get rid of npm-utils (#688) 2020-06-18 16:40:09 +02:00
.github Do not use debian snapshots for building the docker images (#735) 2020-08-11 15:14:31 +02:00
asterius WIP (squash and rebase onto master) 2020-08-11 15:34:08 +02:00
docs Add a section about code formatting in hacking.md (#732) 2020-08-11 13:23:48 +02:00
ghc-toolkit Toolchain update (#733) 2020-08-11 13:23:14 +02:00
utils Toolchain update (#733) 2020-08-11 13:23:14 +02:00
wasm-toolkit Remove obsolete LinkingSection from wasm-toolkit (#550) 2020-04-12 22:55:58 +02:00
.dockerignore Ship a subset of Stackage LTS packages in the pre-built Docker image (#355) 2019-12-03 14:20:45 +01:00
.envrc Add vscode remote containers support (#487) 2020-03-13 16:16:50 +01:00
.ghcid Fix blackholing behavior with multi-threading (#493) 2020-03-18 00:16:48 +01:00
.gitignore Get rid of npm-utils (#688) 2020-06-18 16:40:09 +02:00
base.Dockerfile Do not use debian snapshots for building the docker images (#735) 2020-08-11 15:14:31 +02:00
dev.Dockerfile Do not use debian snapshots for building the docker images (#735) 2020-08-11 15:14:31 +02:00
lts-profile.sh Speed up the asterius-profile job (#597) 2020-04-20 13:12:43 +02:00
lts.sh Toolchain update and misc other improvements (#701) 2020-07-02 12:14:08 +02:00
pkgs.txt Toolchain update and misc other improvements (#701) 2020-07-02 12:14:08 +02:00
README.md Project status & roadmap (#728) 2020-08-06 15:02:23 +02:00
stack-profile.yaml Toolchain update (#733) 2020-08-11 13:23:14 +02:00
stack.yaml Toolchain update (#733) 2020-08-11 13:23:14 +02:00
stackage.Dockerfile ahc-cabal improvement (#685) 2020-06-18 16:40:38 +02:00

Asterius: A Haskell to WebAssembly compiler

Docker Pulls Gitter Netlify Status

Asterius is a Haskell to WebAssembly compiler based on GHC. It compiles Haskell source files or Cabal executable targets to WebAssembly+JavaScript code which can be run in Node.js or browsers. It features seamless JavaScript interop (lightweight Async FFI with Promise support) and small output code (~600KB hello.wasm for a Hello World). A lot of common Haskell packages like lens are already supported. The project is actively maintained by Tweag I/O.

Demos

Demos of popular Haskell apps, running in your browser:

Quickstart using the prebuilt container image

We host a prebuilt container image on Docker Hub. The image also ships ~2k prebuilt packages from a recent Stackage snapshot for convenience of testing simple programs without needing to set up a Cabal project.

To use the image, mount the working directory containing the source code as a shared volume, then use the ahc-link program:

terrorjack@hostname:/project$ podman run -it --rm -v $(pwd):/workspace -w /workspace terrorjack/asterius
root@hostname:/workspace#

There are a lot of link-time options available to ahc-link, e.g. targeting the browser platform instead of node, adding extra GHC options or setting runtime parameters. Check the documentation for further details.

It's also possible to use ahc-cabal as a drop-in replacement of cabal to build a Cabal project. Use ahc-dist with --input-exe on the output "executable" file to generate actual WebAssembly and JavaScript artifacts. See the diagrams blog post for an example.

Check the documentation section about the prebuilt image for more information, e.g. versioning policy, how to use with podman/docker, etc.

Building and using asterius locally

See the Building guide in the documentation for details.

Hacking on Asterius

We recommend using VSCode Remote Containers to reproduce the very same dev environment used by our core team members. See the Hacking guide in the documentation for details.

Documentation

We have documentation and blog posts:

Also checkout the HIW 2018 lightning talk, and the slides of an introductory talk in 2020 here.

Note that they may be slightly out-of-date as the project evolves. Whenever you find something in the docs of blog posts which doesn't reflect the status quo, it's a bug and don't hesitate to open a ticket :)

Project status & roadmap

See the roadmap section in the documentation for details.

Contributors

                     

Asterius is maintained by Tweag I/O.

Have questions? Need help? Tweet at @tweagio.