wasmedge-hs-0.17.1.0: Haskell bindings for the WasmEdge WebAssembly runtime
Copyright(c) 2026 Tushar Adhatrao
LicenseMIT
Stabilitystable
Safe HaskellNone
LanguageGHC2021

WasmEdge.Configure

Description

The Configure context controls which WASM proposals are enabled, how the compiler behaves, and which built-in host modules are registered.

Example:

import WasmEdge.Configure
import WasmEdge.Types

main :: IO ()
main = withConfigure $ cfg -> do
  addProposal cfg SIMD
  addProposal cfg Threads
  setMaxMemoryPage cfg 65536
  setRunMode cfg RunModeAOT
  -- pass cfg to VM or Executor...
Synopsis

Configure context

data Configure #

Opaque WasmEdge configuration context. Create with createConfigure or use withConfigure for scoped use.

createConfigure :: IO Configure #

Create a new Configure with default settings. The caller is responsible for calling deleteConfigure or using withConfigure.

deleteConfigure :: Configure -> IO () #

Explicitly delete a Configure context. After this call, the Configure must not be used.

withConfigure :: (Configure -> IO a) -> IO a #

Scoped Configure context. withConfigure action creates a Configure, passes it to action, and ensures it is deleted when action completes (even on exception).

Proposals

addProposal :: Configure -> Proposal -> IO () #

Add a Proposal to the configuration.

removeProposal :: Configure -> Proposal -> IO () #

Remove a Proposal from the configuration.

hasProposal :: Configure -> Proposal -> IO Bool #

Check whether a Proposal is currently enabled.

setWasmStandard :: Configure -> WasmStandard -> IO () #

Set all proposals to match a standard preset.

Host registrations

addHostRegistration :: Configure -> HostRegistration -> IO () #

Enable a built-in host module (e.g., WASI).

removeHostRegistration :: Configure -> HostRegistration -> IO () #

Disable a built-in host module.

hasHostRegistration :: Configure -> HostRegistration -> IO Bool #

Check whether a host module is registered.

Memory limits

setMaxMemoryPage :: Configure -> Word32 -> IO () #

Set the maximum number of memory pages (default: 65536 = 4 GiB).

getMaxMemoryPage :: Configure -> IO Word32 #

Get the current maximum memory page count.

Run mode (0.18+)

setRunMode :: Configure -> RunMode -> IO () #

Set the execution run mode.

getRunMode :: Configure -> IO RunMode #

Get the current run mode.

Interpreter options

Compiler options

Statistics options

Internal / borrowed pointers

unsafeConfigurePtr :: Configure -> IO (Ptr ConfigureTag) #

Extract the underlying pointer for passing to other contexts (unsafe).

borrowConfigure :: Ptr ConfigureTag -> IO Configure #

Create a borrowed Configure context from an existing pointer.