Source code for guppylang.std.qsystem.wasm

"""Guppy standard library for WebAssembly-style (wasm) contexts"""

from typing import no_type_check

from guppylang.decorator import guppy
from guppylang.std.builtins import Function, array, comptime, nat

T = guppy.type_var("T", copyable=False, droppable=False)


[docs] @guppy @no_type_check def spawn_wasm_contexts(n: nat @ comptime, spawn: Function[[nat], T]) -> "array[T, n]": # noqa: F821 return array(spawn(nat(ix)) for ix in range(n))