

GitHub - tweag/asterius: A Haskell to WebAssembly compiler
source link: https://github.com/tweag/asterius
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md
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
- Haskell WebAssembly calling JavaScript and back again
- Asterius GHC WebAssembly backend reaches TodoMVC
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 likeprint_i64
or JavaScript FFI. - Fast arbitrary-precision
Integer
operations backed byBigInt
s. - Persistent "vault"s which are KV stores transferrable across asterius instances.
- Importing JavaScript expressions via the
foreign import javascript
syntax. First-classJSVal
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 viaStablePtr
. - 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.
Recommend
-
50
-
44
-
42
A Haskell Compiler How does a Haskell compiler work? Can all reason about how a C compiler works but Haskell seems difficult Will try to give you an idea of how GHC work...
-
59
Asterius: A Haskell to WebAssembly compiler A Haskell to WebAssembly compiler. Project status: alpha , in active development, some simple examples already work. See the
-
3
2022-12-21 05:24 Utopia Group 完成 1000 万欧元融资,Asterius VC 领投 据 cryptonews 报道,12 月 21 日,NFT 公司 Utopia Group 完成 1000 万欧元融资,本轮融资由 Asterius VC 领投并将为其推出的首个 NFT 系...
-
6
a dependency checker for your Python code14 March 2023 — by Johan Herland, Nour El Mawass, Maria Knorps, Vince ReuterAnnouncing FawltyDeps - a dependency checker for your Python codeIt is a truth uni...
-
2
Announcing Topiary9 March 2023 — by Erin van der Veen, Nicolas Bacquey, Guillaume Genestier, Christopher Harrison, and Tor HovlandAnnouncing Topiary
-
4
Why Liquid Haskell matters19 January 2022 — by Facundo DomínguezWhy Liquid Haskell mattersSince the inception of the Haskell language, the community around it has steadily innovated with language ext...
-
8
Processing medical images at scale on the cloud20 April 2023 — by Guillaume DesforgesProcessing medical images at scale on the cloudArtificial Intelligence (AI). Machine Learning (ML). Deep Learning....
-
4
Building a Rust workspace with Bazel27 July 2023 — by Ilya PolyakovskiyBuilding a Rust workspace with BazelThe vast majority of the Rust projects are using Cargo as a build tool. Cargo is great when...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK