Module

Wasm.Char

Package
purescript-wasm-base
Repository
purs-wasm/purescript-wasm-base

WasmBase Wasm.Char (ADR 0026 / 0030): the Char ↔ code-point Int conversions the Data.String.* UTF-8 codec is written over. A Char is a Unicode code point on this backend (ADR 0030 — not a UTF-16 code unit), represented as an i32, so both directions are the identity on that i32; on wasm they resolve to the CharCodeId intrinsic (no-op). Per ADR 0026, Wasm.* is first-order only — no HOFs, no Prelude. All types are Prim (Char / Int).

The accompanying Wasm/Char.js provides them for stock purs / purs-backend-es (there a Char is a JS UTF-16 unit, so the JS impls use charCodeAt / fromCharCode).

#toCodePoint Source

toCodePoint :: Char -> Int

The Char's Unicode code point. On wasm: the CharCodeId intrinsic (identity).

#fromCodePoint Source

fromCodePoint :: Int -> Char

The Char for a code point, unchecked (the caller guarantees a valid code point; the UTF-8 decoder only ever produces valid ones). On wasm: the CharCodeId intrinsic (identity).