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.
-
Intended to be used with the
purs-wasmbackend. TheWasm.*modules expose, on the PureScript side, the first-order primitives the compiler resolves to wasm intrinsics (e.g.Wasm.Array.unsafeNew→array.new,unsafeIndex→array.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 onwasm-basestill compiles and runs on stockpurs/purs-backend-es— it is not locked topurs-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
unsafeand low-level — unchecked indexing, manual allocation and in-place mutation. Its purpose is to let library higher-order combinators (Data.Array'smap/foldl/filter, …) be written in PureScript over it so their closures specialize on wasm. Prefer those library functions; reach forWasm.*only when you must.
MIT © Katsujukou Kineya