Skip to content

Wasm via Golang

Andy Arvanitis edited this page Aug 10, 2019 · 5 revisions

There's not much to it. Instead of building a regular executable with

$ spago build -- -g corefn && psgo

you add a couple of Go environment variables:

$ spago build -- -g corefn && GOOS=js GOARCH=wasm GOFLAGS=-o=main.wasm psgo

You can then test it using the instructions from the relevant section of the Go wiki.

I have only tested in the browser (both Safari and Chrome on macOS) using their instructions. Specifically, I tried TCO.purs and it ran fine. If you test in the browser, make sure to enable your browser's javascript console to see the output.

See the Go wiki section on WebAssembly for more information.

Clone this wiki locally
You can’t perform that action at this time.