| Copyright | (c) 2026 Tushar Adhatrao |
|---|---|
| License | MIT |
| Stability | stable |
| Safe Haskell | None |
| Language | GHC2021 |
WasmEdge.Types
Description
Defines the Haskell representation of WebAssembly types used throughout
the binding: WasmVal, ValType, Mutability, ExternalType,
Limit, and other shared data types.
Synopsis
- data WasmVal
- newtype FuncRef = FuncRefPtr {
- funcRefPtr :: Ptr ()
- newtype ExternRef = ExternRefPtr {
- externRefPtr :: Ptr ()
- data ValType
- data Limit = Limit {}
- unlimitedLimit :: Word32 -> Limit
- data Mutability
- data ExternalType
- data Proposal
- data WasmStandard
- data HostRegistration
- data RunMode
- data OptimizationLevel
- data OutputFormat
WASM Values
A WebAssembly value, covering all WASM numeric and reference types.
Constructors
| WasmI32 !Int32 | 32-bit integer (signed in Haskell, interchangeable with unsigned in WASM) |
| WasmI64 !Int64 | 64-bit integer |
| WasmF32 !Float | 32-bit IEEE 754 float |
| WasmF64 !Double | 64-bit IEEE 754 double |
| WasmV128 !Int128 | 128-bit SIMD vector (from |
| WasmFuncRef !(Maybe FuncRef) | Function reference (nullable). |
| WasmExternRef !(Maybe ExternRef) | External reference (nullable). |
Instances
An opaque reference to a WasmEdge FunctionInstance.
Obtained via getFuncRef or from a WasmVal.
Constructors
| FuncRefPtr | |
Fields
| |
An opaque reference to an external (host) object.
Created via mkExternRef.
Constructors
| ExternRefPtr | |
Fields
| |
Value types
The type of a WebAssembly value. Used in function signatures and global/table type descriptors.
Constructors
| I32 | 32-bit integer |
| I64 | 64-bit integer |
| F32 | 32-bit float |
| F64 | 64-bit float |
| V128 | 128-bit SIMD vector |
| FuncRefT | Function reference ( |
| ExternRefT | External reference ( |
Instances
| NFData ValType # | |||||
Defined in WasmEdge.Types | |||||
| Bounded ValType # | |||||
| Enum ValType # | |||||
| Generic ValType # | |||||
Defined in WasmEdge.Types Associated Types
| |||||
| Show ValType # | |||||
| Eq ValType # | |||||
| Ord ValType # | |||||
| type Rep ValType # | |||||
Defined in WasmEdge.Types type Rep ValType = D1 ('MetaData "ValType" "WasmEdge.Types" "wasmedge-hs-0.17.1.0-inplace" 'False) ((C1 ('MetaCons "I32" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "I64" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "F32" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "F64" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "V128" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "FuncRefT" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ExternRefT" 'PrefixI 'False) (U1 :: Type -> Type)))) | |||||
Limits
A WebAssembly limit (min, optional max) as used in table and memory types.
Constructors
| Limit | |
Instances
| NFData Limit # | |||||
Defined in WasmEdge.Types | |||||
| Generic Limit # | |||||
Defined in WasmEdge.Types Associated Types
| |||||
| Show Limit # | |||||
| Eq Limit # | |||||
| type Rep Limit # | |||||
Defined in WasmEdge.Types type Rep Limit = D1 ('MetaData "Limit" "WasmEdge.Types" "wasmedge-hs-0.17.1.0-inplace" 'False) (C1 ('MetaCons "Limit" 'PrefixI 'True) (S1 ('MetaSel ('Just "limitMin") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word32) :*: (S1 ('MetaSel ('Just "limitMax") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Maybe Word32)) :*: S1 ('MetaSel ('Just "limitShared") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool)))) | |||||
unlimitedLimit :: Word32 -> Limit #
An unlimited limit (no max, not shared).
Mutability
data Mutability #
Global mutability.
Instances
| NFData Mutability # | |||||
Defined in WasmEdge.Types Methods rnf :: Mutability -> () # | |||||
| Bounded Mutability # | |||||
Defined in WasmEdge.Types | |||||
| Enum Mutability # | |||||
Defined in WasmEdge.Types Methods succ :: Mutability -> Mutability # pred :: Mutability -> Mutability # toEnum :: Int -> Mutability # fromEnum :: Mutability -> Int # enumFrom :: Mutability -> [Mutability] # enumFromThen :: Mutability -> Mutability -> [Mutability] # enumFromTo :: Mutability -> Mutability -> [Mutability] # enumFromThenTo :: Mutability -> Mutability -> Mutability -> [Mutability] # | |||||
| Generic Mutability # | |||||
Defined in WasmEdge.Types Associated Types
| |||||
| Show Mutability # | |||||
Defined in WasmEdge.Types Methods showsPrec :: Int -> Mutability -> ShowS # show :: Mutability -> String # showList :: [Mutability] -> ShowS # | |||||
| Eq Mutability # | |||||
Defined in WasmEdge.Types | |||||
| Ord Mutability # | |||||
Defined in WasmEdge.Types Methods compare :: Mutability -> Mutability -> Ordering # (<) :: Mutability -> Mutability -> Bool # (<=) :: Mutability -> Mutability -> Bool # (>) :: Mutability -> Mutability -> Bool # (>=) :: Mutability -> Mutability -> Bool # max :: Mutability -> Mutability -> Mutability # min :: Mutability -> Mutability -> Mutability # | |||||
| type Rep Mutability # | |||||
External types (for import/export)
data ExternalType #
The kind of entity imported or exported by a module.
Constructors
| ExternalFunction | |
| ExternalTable | |
| ExternalMemory | |
| ExternalGlobal | |
| ExternalTag |
|
Instances
| NFData ExternalType # | |||||
Defined in WasmEdge.Types Methods rnf :: ExternalType -> () # | |||||
| Bounded ExternalType # | |||||
Defined in WasmEdge.Types | |||||
| Enum ExternalType # | |||||
Defined in WasmEdge.Types Methods succ :: ExternalType -> ExternalType # pred :: ExternalType -> ExternalType # toEnum :: Int -> ExternalType # fromEnum :: ExternalType -> Int # enumFrom :: ExternalType -> [ExternalType] # enumFromThen :: ExternalType -> ExternalType -> [ExternalType] # enumFromTo :: ExternalType -> ExternalType -> [ExternalType] # enumFromThenTo :: ExternalType -> ExternalType -> ExternalType -> [ExternalType] # | |||||
| Generic ExternalType # | |||||
Defined in WasmEdge.Types Associated Types
| |||||
| Show ExternalType # | |||||
Defined in WasmEdge.Types Methods showsPrec :: Int -> ExternalType -> ShowS # show :: ExternalType -> String # showList :: [ExternalType] -> ShowS # | |||||
| Eq ExternalType # | |||||
Defined in WasmEdge.Types | |||||
| Ord ExternalType # | |||||
Defined in WasmEdge.Types Methods compare :: ExternalType -> ExternalType -> Ordering # (<) :: ExternalType -> ExternalType -> Bool # (<=) :: ExternalType -> ExternalType -> Bool # (>) :: ExternalType -> ExternalType -> Bool # (>=) :: ExternalType -> ExternalType -> Bool # max :: ExternalType -> ExternalType -> ExternalType # min :: ExternalType -> ExternalType -> ExternalType # | |||||
| type Rep ExternalType # | |||||
Defined in WasmEdge.Types type Rep ExternalType = D1 ('MetaData "ExternalType" "WasmEdge.Types" "wasmedge-hs-0.17.1.0-inplace" 'False) ((C1 ('MetaCons "ExternalFunction" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ExternalTable" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "ExternalMemory" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ExternalGlobal" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ExternalTag" 'PrefixI 'False) (U1 :: Type -> Type)))) | |||||
Proposals
WebAssembly proposals that can be enabled in Configure.
Constructors
| ImportExportMutGlobals | 0: Import/export mutable globals |
| NonTrapFloatToIntConversions | 1: Non-trap float-to-int conversions |
| SignExtensionOperators | 2: Sign-extension operators |
| MultiValue | 3: Multiple return values |
| BulkMemoryOperations | 4: Bulk memory operations |
| ReferenceTypes | 5: Reference types |
| SIMD | 6: SIMD (fixed-width) |
| TailCall | 7: Tail call optimization |
| ExtendedConst | 8: Extended constant expressions |
| FunctionReferences | 9: Typed function references |
| GC | 10: Garbage collection |
| MultiMemories | 11: Multiple memories |
| RelaxedSIMD | 12: Relaxed SIMD |
| Annotations | 13: Custom section annotations |
| ExceptionHandling | 14: Exception handling |
| Memory64 | 15: 64-bit memory indices |
| Threads | 16: Threads (shared memory + atomics) |
| ComponentModel | 17: Component model |
Instances
| NFData Proposal # | |||||
Defined in WasmEdge.Types | |||||
| Bounded Proposal # | |||||
| Enum Proposal # | |||||
| Generic Proposal # | |||||
Defined in WasmEdge.Types Associated Types
| |||||
| Show Proposal # | |||||
| Eq Proposal # | |||||
| Ord Proposal # | |||||
Defined in WasmEdge.Types | |||||
| type Rep Proposal # | |||||
Defined in WasmEdge.Types type Rep Proposal = D1 ('MetaData "Proposal" "WasmEdge.Types" "wasmedge-hs-0.17.1.0-inplace" 'False) ((((C1 ('MetaCons "ImportExportMutGlobals" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NonTrapFloatToIntConversions" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "SignExtensionOperators" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MultiValue" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "BulkMemoryOperations" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ReferenceTypes" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "SIMD" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "TailCall" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ExtendedConst" 'PrefixI 'False) (U1 :: Type -> Type))))) :+: (((C1 ('MetaCons "FunctionReferences" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "GC" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "MultiMemories" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "RelaxedSIMD" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "Annotations" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ExceptionHandling" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Memory64" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Threads" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ComponentModel" 'PrefixI 'False) (U1 :: Type -> Type)))))) | |||||
WASM standard
data WasmStandard #
A WASM standard preset that sets a group of proposals at once.
Constructors
| WASM1 | WASM 1.0 (MVP) |
| WASM2 | WASM 2.0 |
| WASM3 | WASM 3.0 (includes tail-call, extended-const, function refs, GC, EH, ...) |
Instances
| NFData WasmStandard # | |||||
Defined in WasmEdge.Types Methods rnf :: WasmStandard -> () # | |||||
| Bounded WasmStandard # | |||||
Defined in WasmEdge.Types | |||||
| Enum WasmStandard # | |||||
Defined in WasmEdge.Types Methods succ :: WasmStandard -> WasmStandard # pred :: WasmStandard -> WasmStandard # toEnum :: Int -> WasmStandard # fromEnum :: WasmStandard -> Int # enumFrom :: WasmStandard -> [WasmStandard] # enumFromThen :: WasmStandard -> WasmStandard -> [WasmStandard] # enumFromTo :: WasmStandard -> WasmStandard -> [WasmStandard] # enumFromThenTo :: WasmStandard -> WasmStandard -> WasmStandard -> [WasmStandard] # | |||||
| Generic WasmStandard # | |||||
Defined in WasmEdge.Types Associated Types
| |||||
| Show WasmStandard # | |||||
Defined in WasmEdge.Types Methods showsPrec :: Int -> WasmStandard -> ShowS # show :: WasmStandard -> String # showList :: [WasmStandard] -> ShowS # | |||||
| Eq WasmStandard # | |||||
Defined in WasmEdge.Types | |||||
| Ord WasmStandard # | |||||
Defined in WasmEdge.Types Methods compare :: WasmStandard -> WasmStandard -> Ordering # (<) :: WasmStandard -> WasmStandard -> Bool # (<=) :: WasmStandard -> WasmStandard -> Bool # (>) :: WasmStandard -> WasmStandard -> Bool # (>=) :: WasmStandard -> WasmStandard -> Bool # max :: WasmStandard -> WasmStandard -> WasmStandard # min :: WasmStandard -> WasmStandard -> WasmStandard # | |||||
| type Rep WasmStandard # | |||||
Defined in WasmEdge.Types type Rep WasmStandard = D1 ('MetaData "WasmStandard" "WasmEdge.Types" "wasmedge-hs-0.17.1.0-inplace" 'False) (C1 ('MetaCons "WASM1" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "WASM2" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "WASM3" 'PrefixI 'False) (U1 :: Type -> Type))) | |||||
Host registrations
data HostRegistration #
Built-in host module registrations.
Constructors
| HostWASI | Register the WASI module |
| HostWasmEdgeProcess | Deprecated: wasmedge_process was removed in WasmEdge 0.18. Use HostWASI instead.
|
Instances
| NFData HostRegistration # | |||||
Defined in WasmEdge.Types Methods rnf :: HostRegistration -> () # | |||||
| Bounded HostRegistration # | |||||
Defined in WasmEdge.Types | |||||
| Enum HostRegistration # | |||||
Defined in WasmEdge.Types Methods succ :: HostRegistration -> HostRegistration # pred :: HostRegistration -> HostRegistration # toEnum :: Int -> HostRegistration # fromEnum :: HostRegistration -> Int # enumFrom :: HostRegistration -> [HostRegistration] # enumFromThen :: HostRegistration -> HostRegistration -> [HostRegistration] # enumFromTo :: HostRegistration -> HostRegistration -> [HostRegistration] # enumFromThenTo :: HostRegistration -> HostRegistration -> HostRegistration -> [HostRegistration] # | |||||
| Generic HostRegistration # | |||||
Defined in WasmEdge.Types Associated Types
Methods from :: HostRegistration -> Rep HostRegistration x # to :: Rep HostRegistration x -> HostRegistration # | |||||
| Show HostRegistration # | |||||
Defined in WasmEdge.Types Methods showsPrec :: Int -> HostRegistration -> ShowS # show :: HostRegistration -> String # showList :: [HostRegistration] -> ShowS # | |||||
| Eq HostRegistration # | |||||
Defined in WasmEdge.Types Methods (==) :: HostRegistration -> HostRegistration -> Bool # (/=) :: HostRegistration -> HostRegistration -> Bool # | |||||
| Ord HostRegistration # | |||||
Defined in WasmEdge.Types Methods compare :: HostRegistration -> HostRegistration -> Ordering # (<) :: HostRegistration -> HostRegistration -> Bool # (<=) :: HostRegistration -> HostRegistration -> Bool # (>) :: HostRegistration -> HostRegistration -> Bool # (>=) :: HostRegistration -> HostRegistration -> Bool # max :: HostRegistration -> HostRegistration -> HostRegistration # min :: HostRegistration -> HostRegistration -> HostRegistration # | |||||
| type Rep HostRegistration # | |||||
Run mode
The execution mode for the WasmEdge runtime.
Constructors
| RunModeInterpreter | Pure interpreter (always available) |
| RunModeAOT | AOT compiled (requires compiled binary) |
| RunModeLazyJIT | Lazy JIT: compile on first function call (0.18+) |
Instances
| NFData RunMode # | |||||
Defined in WasmEdge.Types | |||||
| Bounded RunMode # | |||||
| Enum RunMode # | |||||
| Generic RunMode # | |||||
Defined in WasmEdge.Types Associated Types
| |||||
| Show RunMode # | |||||
| Eq RunMode # | |||||
| Ord RunMode # | |||||
| type Rep RunMode # | |||||
Defined in WasmEdge.Types type Rep RunMode = D1 ('MetaData "RunMode" "WasmEdge.Types" "wasmedge-hs-0.17.1.0-inplace" 'False) (C1 ('MetaCons "RunModeInterpreter" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "RunModeAOT" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "RunModeLazyJIT" 'PrefixI 'False) (U1 :: Type -> Type))) | |||||
Compiler settings
data OptimizationLevel #
AOT compiler optimization level.
Constructors
| OptO0 | No optimization |
| OptO1 | Basic optimization |
| OptO2 | Default optimization |
| OptO3 | Aggressive optimization |
| OptOs | Optimize for size |
| OptOz | Aggressive size optimization |
Instances
| NFData OptimizationLevel # | |||||
Defined in WasmEdge.Types Methods rnf :: OptimizationLevel -> () # | |||||
| Bounded OptimizationLevel # | |||||
Defined in WasmEdge.Types | |||||
| Enum OptimizationLevel # | |||||
Defined in WasmEdge.Types Methods succ :: OptimizationLevel -> OptimizationLevel # pred :: OptimizationLevel -> OptimizationLevel # toEnum :: Int -> OptimizationLevel # fromEnum :: OptimizationLevel -> Int # enumFrom :: OptimizationLevel -> [OptimizationLevel] # enumFromThen :: OptimizationLevel -> OptimizationLevel -> [OptimizationLevel] # enumFromTo :: OptimizationLevel -> OptimizationLevel -> [OptimizationLevel] # enumFromThenTo :: OptimizationLevel -> OptimizationLevel -> OptimizationLevel -> [OptimizationLevel] # | |||||
| Generic OptimizationLevel # | |||||
Defined in WasmEdge.Types Associated Types
Methods from :: OptimizationLevel -> Rep OptimizationLevel x # to :: Rep OptimizationLevel x -> OptimizationLevel # | |||||
| Show OptimizationLevel # | |||||
Defined in WasmEdge.Types Methods showsPrec :: Int -> OptimizationLevel -> ShowS # show :: OptimizationLevel -> String # showList :: [OptimizationLevel] -> ShowS # | |||||
| Eq OptimizationLevel # | |||||
Defined in WasmEdge.Types Methods (==) :: OptimizationLevel -> OptimizationLevel -> Bool # (/=) :: OptimizationLevel -> OptimizationLevel -> Bool # | |||||
| Ord OptimizationLevel # | |||||
Defined in WasmEdge.Types Methods compare :: OptimizationLevel -> OptimizationLevel -> Ordering # (<) :: OptimizationLevel -> OptimizationLevel -> Bool # (<=) :: OptimizationLevel -> OptimizationLevel -> Bool # (>) :: OptimizationLevel -> OptimizationLevel -> Bool # (>=) :: OptimizationLevel -> OptimizationLevel -> Bool # max :: OptimizationLevel -> OptimizationLevel -> OptimizationLevel # min :: OptimizationLevel -> OptimizationLevel -> OptimizationLevel # | |||||
| type Rep OptimizationLevel # | |||||
Defined in WasmEdge.Types type Rep OptimizationLevel = D1 ('MetaData "OptimizationLevel" "WasmEdge.Types" "wasmedge-hs-0.17.1.0-inplace" 'False) ((C1 ('MetaCons "OptO0" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "OptO1" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "OptO2" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "OptO3" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "OptOs" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "OptOz" 'PrefixI 'False) (U1 :: Type -> Type)))) | |||||
data OutputFormat #
AOT compiler output format.
Constructors
| OutputNativeSharedLibrary | Platform native shared library |
| OutputWasmUniversal | Universal WASM (embeds native + bytecode) |
Instances
| NFData OutputFormat # | |||||
Defined in WasmEdge.Types Methods rnf :: OutputFormat -> () # | |||||
| Bounded OutputFormat # | |||||
Defined in WasmEdge.Types | |||||
| Enum OutputFormat # | |||||
Defined in WasmEdge.Types Methods succ :: OutputFormat -> OutputFormat # pred :: OutputFormat -> OutputFormat # toEnum :: Int -> OutputFormat # fromEnum :: OutputFormat -> Int # enumFrom :: OutputFormat -> [OutputFormat] # enumFromThen :: OutputFormat -> OutputFormat -> [OutputFormat] # enumFromTo :: OutputFormat -> OutputFormat -> [OutputFormat] # enumFromThenTo :: OutputFormat -> OutputFormat -> OutputFormat -> [OutputFormat] # | |||||
| Generic OutputFormat # | |||||
Defined in WasmEdge.Types Associated Types
| |||||
| Show OutputFormat # | |||||
Defined in WasmEdge.Types Methods showsPrec :: Int -> OutputFormat -> ShowS # show :: OutputFormat -> String # showList :: [OutputFormat] -> ShowS # | |||||
| Eq OutputFormat # | |||||
Defined in WasmEdge.Types | |||||
| Ord OutputFormat # | |||||
Defined in WasmEdge.Types Methods compare :: OutputFormat -> OutputFormat -> Ordering # (<) :: OutputFormat -> OutputFormat -> Bool # (<=) :: OutputFormat -> OutputFormat -> Bool # (>) :: OutputFormat -> OutputFormat -> Bool # (>=) :: OutputFormat -> OutputFormat -> Bool # max :: OutputFormat -> OutputFormat -> OutputFormat # min :: OutputFormat -> OutputFormat -> OutputFormat # | |||||
| type Rep OutputFormat # | |||||