Package

purescript-wasm-base

Repository
purs-wasm/purescript-wasm-base
License
MIT
Uploaded by
pacchettibotti
Published on
2026-06-12T21:30:39Z

The WasmBase primitive layer: a thin PureScript bridge to the low-level operations the purs-wasm backend provides as intrinsics. It contains only first-order definitions and depends on no other package.

Notes

  • Intended to be used with the purs-wasm backend. The Wasm.* modules expose, on the PureScript side, the first-order primitives the compiler resolves to wasm intrinsics (e.g. Wasm.Array.unsafeNewarray.new, unsafeIndexarray.get). It is a thin bridge, not a library.

  • Compatibility via JS foreigns. Each primitive also ships a corresponding JS implementation (Wasm/*.js), so a project depending on wasm-base still compiles and runs on stock purs / purs-backend-es — it is not locked to purs-wasm. On the wasm backend the JS foreigns are ignored (the intrinsic wins in the provider ladder; see ADR-0014). In foreign js, we intentionally uses arrow functions only. Because purs-wasm targets Wasm-GC-capable JS runtimes, arrow functions are universally available in practice.

  • Application authors should avoid using this API directly, except in special cases. It is deliberately unsafe and low-level — unchecked indexing, manual allocation and in-place mutation. Its purpose is to let library higher-order combinators (Data.Array's map / foldl / filter, …) be written in PureScript over it so their closures specialize on wasm. Prefer those library functions; reach for Wasm.* only when you must.

License

MIT © Katsujukou Kineya

Modules
Wasm.Array
Wasm.Boolean
Wasm.Char
Wasm.Int
Wasm.String
Dependencies
No dependencies