Skip to content

Commit

Permalink
Haskell > OCaml
Browse files Browse the repository at this point in the history
  • Loading branch information
FinleyMcIlwaine committed Jun 10, 2024
0 parents commit 49c15ba
Show file tree
Hide file tree
Showing 10 changed files with 635 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist-newstyle
dist
.envrc
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# GHC WebAssembly Backend Demonstration - ZuriHac 2024

Credits:
- Finley McIlwaine (author)
- Andreas Klebinger (@AndreasPK)
- Zubin Duggal (@wz1000)
20 changes: 20 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

pushd "$(dirname "$0")" || exit

DIST_DIR=./dist

cabal build wasm-sim

hs_wasm_path=$(find dist-newstyle -name "*.wasm")

"$(wasm32-wasi-ghc --print-libdir)"/post-link.mjs \
--input "$hs_wasm_path" --output $DIST_DIR/ghc_wasm_jsffi.js

cp $hs_wasm_path $DIST_DIR/bin.wasm

# wizer --allow-wasi --wasm-bulk-memory true --init-func _initialize -o $DIST_DIR/bin.wasm "$hs_wasm_path"
# wasm-opt ${1+"$@"} $DIST_DIR/bin.wasm -o $DIST_DIR/bin.wasm
# wasm-tools strip -o $DIST_DIR/bin.wasm $DIST_DIR/bin.wasm

cp ./src/* ./dist/
12 changes: 12 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
packages: .

with-compiler: wasm32-wasi-ghc
with-hc-pkg: wasm32-wasi-ghc-pkg

source-repository-package
type: git
location: https://github.com/amesgen/splitmix
tag: 83b906c4bcdc2720546f1779a16eb65e8e12ecba

allow-newer:
splitmix:*
Loading

0 comments on commit 49c15ba

Please sign in to comment.