-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | WebAssembly Language Toolkit and Interpreter
--
-- This package contains fully spec-compatible tooling for WebAssembly.
-- Features include:
--
--
-- - WebAssembly Text Representation Parser
-- - WebAssembly Binary Representation encoder and decoder
-- - Spec-compatible Module validator (checked with Spec Core Test
-- Suite)
-- - Spec-compatible Interpreter (checked with Spec Core Test
-- Suite)
-- - Extended scipting grammar parser and executor
-- - WebAssembly Module building eDSL
--
@package wasm
@version 1.0.0
module Language.Wasm.FloatUtils
wordToFloat :: Word32 -> Float
floatToWord :: Float -> Word32
wordToDouble :: Word64 -> Double
doubleToWord :: Double -> Word64
makeNaN :: Word64 -> Double
doubleToFloat :: Double -> Float
module Language.Wasm.Lexer
data Lexeme
Lexeme :: Maybe AlexPosn -> Token -> Lexeme
[pos] :: Lexeme -> Maybe AlexPosn
[tok] :: Lexeme -> Token
data Token
TKeyword :: ByteString -> Token
TIntLit :: Integer -> Token
TFloatLit :: FloatRep -> Token
TStringLit :: ByteString -> Token
TId :: ByteString -> Token
TOpenBracket :: Token
TCloseBracket :: Token
TReserved :: ByteString -> Token
EOF :: Token
data AlexPosn
AlexPn :: !Int -> !Int -> !Int -> AlexPosn
scanner :: ByteString -> Either String [Lexeme]
asFloat :: FloatRep -> Either String Float
asDouble :: FloatRep -> Either String Double
instance GHC.Classes.Eq Language.Wasm.Lexer.Lexeme
instance GHC.Show.Show Language.Wasm.Lexer.Lexeme
instance GHC.Classes.Eq Language.Wasm.Lexer.Token
instance GHC.Show.Show Language.Wasm.Lexer.Token
instance GHC.Classes.Eq Language.Wasm.Lexer.FloatRep
instance GHC.Show.Show Language.Wasm.Lexer.FloatRep
instance GHC.Show.Show Language.Wasm.Lexer.AlexPosn
instance GHC.Classes.Eq Language.Wasm.Lexer.AlexPosn
instance GHC.Base.Functor Language.Wasm.Lexer.Alex
instance GHC.Base.Applicative Language.Wasm.Lexer.Alex
instance GHC.Base.Monad Language.Wasm.Lexer.Alex
module Language.Wasm.Structure
data Module
Module :: [FuncType] -> [Function] -> [Table] -> [Memory] -> [Global] -> [ElemSegment] -> [DataSegment] -> Maybe StartFunction -> [Import] -> [Export] -> Module
[$sel:types:Module] :: Module -> [FuncType]
[$sel:functions:Module] :: Module -> [Function]
[$sel:tables:Module] :: Module -> [Table]
[$sel:mems:Module] :: Module -> [Memory]
[$sel:globals:Module] :: Module -> [Global]
[$sel:elems:Module] :: Module -> [ElemSegment]
[$sel:datas:Module] :: Module -> [DataSegment]
[$sel:start:Module] :: Module -> Maybe StartFunction
[$sel:imports:Module] :: Module -> [Import]
[$sel:exports:Module] :: Module -> [Export]
data DataSegment
DataSegment :: MemoryIndex -> Expression -> ByteString -> DataSegment
[$sel:memIndex:DataSegment] :: DataSegment -> MemoryIndex
[$sel:offset:DataSegment] :: DataSegment -> Expression
[$sel:chunk:DataSegment] :: DataSegment -> ByteString
data ElemSegment
ElemSegment :: TableIndex -> Expression -> [FuncIndex] -> ElemSegment
[$sel:tableIndex:ElemSegment] :: ElemSegment -> TableIndex
[$sel:offset:ElemSegment] :: ElemSegment -> Expression
[$sel:funcIndexes:ElemSegment] :: ElemSegment -> [FuncIndex]
data StartFunction
StartFunction :: FuncIndex -> StartFunction
data Export
Export :: Text -> ExportDesc -> Export
[$sel:name:Export] :: Export -> Text
[$sel:desc:Export] :: Export -> ExportDesc
data ExportDesc
ExportFunc :: FuncIndex -> ExportDesc
ExportTable :: TableIndex -> ExportDesc
ExportMemory :: MemoryIndex -> ExportDesc
ExportGlobal :: GlobalIndex -> ExportDesc
data Table
Table :: TableType -> Table
data Memory
Memory :: Limit -> Memory
data Global
Global :: GlobalType -> Expression -> Global
[$sel:globalType:Global] :: Global -> GlobalType
[$sel:initializer:Global] :: Global -> Expression
data Function
Function :: TypeIndex -> LocalsType -> Expression -> Function
[$sel:funcType:Function] :: Function -> TypeIndex
[$sel:localTypes:Function] :: Function -> LocalsType
[$sel:body:Function] :: Function -> Expression
data Import
Import :: Text -> Text -> ImportDesc -> Import
[$sel:sourceModule:Import] :: Import -> Text
[$sel:name:Import] :: Import -> Text
[$sel:desc:Import] :: Import -> ImportDesc
data ImportDesc
ImportFunc :: TypeIndex -> ImportDesc
ImportTable :: TableType -> ImportDesc
ImportMemory :: Limit -> ImportDesc
ImportGlobal :: GlobalType -> ImportDesc
data Instruction index
Unreachable :: Instruction index
Nop :: Instruction index
Block :: ResultType -> Expression -> Instruction index
[$sel:resultType:Unreachable] :: Instruction index -> ResultType
[$sel:body:Unreachable] :: Instruction index -> Expression
Loop :: ResultType -> Expression -> Instruction index
[$sel:resultType:Unreachable] :: Instruction index -> ResultType
[$sel:body:Unreachable] :: Instruction index -> Expression
If :: ResultType -> Expression -> Expression -> Instruction index
[$sel:resultType:Unreachable] :: Instruction index -> ResultType
[$sel:true:Unreachable] :: Instruction index -> Expression
[$sel:false:Unreachable] :: Instruction index -> Expression
Br :: index -> Instruction index
BrIf :: index -> Instruction index
BrTable :: [index] -> index -> Instruction index
Return :: Instruction index
Call :: index -> Instruction index
CallIndirect :: index -> Instruction index
Drop :: Instruction index
Select :: Instruction index
GetLocal :: index -> Instruction index
SetLocal :: index -> Instruction index
TeeLocal :: index -> Instruction index
GetGlobal :: index -> Instruction index
SetGlobal :: index -> Instruction index
I32Load :: MemArg -> Instruction index
I64Load :: MemArg -> Instruction index
F32Load :: MemArg -> Instruction index
F64Load :: MemArg -> Instruction index
I32Load8S :: MemArg -> Instruction index
I32Load8U :: MemArg -> Instruction index
I32Load16S :: MemArg -> Instruction index
I32Load16U :: MemArg -> Instruction index
I64Load8S :: MemArg -> Instruction index
I64Load8U :: MemArg -> Instruction index
I64Load16S :: MemArg -> Instruction index
I64Load16U :: MemArg -> Instruction index
I64Load32S :: MemArg -> Instruction index
I64Load32U :: MemArg -> Instruction index
I32Store :: MemArg -> Instruction index
I64Store :: MemArg -> Instruction index
F32Store :: MemArg -> Instruction index
F64Store :: MemArg -> Instruction index
I32Store8 :: MemArg -> Instruction index
I32Store16 :: MemArg -> Instruction index
I64Store8 :: MemArg -> Instruction index
I64Store16 :: MemArg -> Instruction index
I64Store32 :: MemArg -> Instruction index
CurrentMemory :: Instruction index
GrowMemory :: Instruction index
I32Const :: Word32 -> Instruction index
I64Const :: Word64 -> Instruction index
F32Const :: Float -> Instruction index
F64Const :: Double -> Instruction index
IUnOp :: BitSize -> IUnOp -> Instruction index
IBinOp :: BitSize -> IBinOp -> Instruction index
I32Eqz :: Instruction index
I64Eqz :: Instruction index
IRelOp :: BitSize -> IRelOp -> Instruction index
FUnOp :: BitSize -> FUnOp -> Instruction index
FBinOp :: BitSize -> FBinOp -> Instruction index
FRelOp :: BitSize -> FRelOp -> Instruction index
I32WrapI64 :: Instruction index
ITruncFU :: BitSize -> BitSize -> Instruction index
ITruncFS :: BitSize -> BitSize -> Instruction index
I64ExtendSI32 :: Instruction index
I64ExtendUI32 :: Instruction index
FConvertIU :: BitSize -> BitSize -> Instruction index
FConvertIS :: BitSize -> BitSize -> Instruction index
F32DemoteF64 :: Instruction index
F64PromoteF32 :: Instruction index
IReinterpretF :: BitSize -> Instruction index
FReinterpretI :: BitSize -> Instruction index
data MemArg
MemArg :: Natural -> Natural -> MemArg
[$sel:offset:MemArg] :: MemArg -> Natural
[$sel:align:MemArg] :: MemArg -> Natural
data IUnOp
IClz :: IUnOp
ICtz :: IUnOp
IPopcnt :: IUnOp
data IBinOp
IAdd :: IBinOp
ISub :: IBinOp
IMul :: IBinOp
IDivU :: IBinOp
IDivS :: IBinOp
IRemU :: IBinOp
IRemS :: IBinOp
IAnd :: IBinOp
IOr :: IBinOp
IXor :: IBinOp
IShl :: IBinOp
IShrU :: IBinOp
IShrS :: IBinOp
IRotl :: IBinOp
IRotr :: IBinOp
data IRelOp
IEq :: IRelOp
INe :: IRelOp
ILtU :: IRelOp
ILtS :: IRelOp
IGtU :: IRelOp
IGtS :: IRelOp
ILeU :: IRelOp
ILeS :: IRelOp
IGeU :: IRelOp
IGeS :: IRelOp
data FUnOp
FAbs :: FUnOp
FNeg :: FUnOp
FCeil :: FUnOp
FFloor :: FUnOp
FTrunc :: FUnOp
FNearest :: FUnOp
FSqrt :: FUnOp
data FBinOp
FAdd :: FBinOp
FSub :: FBinOp
FMul :: FBinOp
FDiv :: FBinOp
FMin :: FBinOp
FMax :: FBinOp
FCopySign :: FBinOp
data FRelOp
FEq :: FRelOp
FNe :: FRelOp
FLt :: FRelOp
FGt :: FRelOp
FLe :: FRelOp
FGe :: FRelOp
data BitSize
BS32 :: BitSize
BS64 :: BitSize
data TableType
TableType :: Limit -> ElemType -> TableType
data ElemType
AnyFunc :: ElemType
data Limit
Limit :: Natural -> (Maybe Natural) -> Limit
data GlobalType
Const :: ValueType -> GlobalType
Mut :: ValueType -> GlobalType
data FuncType
FuncType :: ParamsType -> ResultType -> FuncType
[$sel:params:FuncType] :: FuncType -> ParamsType
[$sel:results:FuncType] :: FuncType -> ResultType
data ValueType
I32 :: ValueType
I64 :: ValueType
F32 :: ValueType
F64 :: ValueType
type ResultType = [ValueType]
type Expression = [Instruction Natural]
type LabelIndex = Natural
type LocalIndex = Natural
type GlobalIndex = Natural
emptyModule :: Module
isFuncImport :: Import -> Bool
isTableImport :: Import -> Bool
isMemImport :: Import -> Bool
isGlobalImport :: Import -> Bool
instance Control.DeepSeq.NFData Language.Wasm.Structure.Module
instance GHC.Generics.Generic Language.Wasm.Structure.Module
instance GHC.Classes.Eq Language.Wasm.Structure.Module
instance GHC.Show.Show Language.Wasm.Structure.Module
instance Control.DeepSeq.NFData Language.Wasm.Structure.Import
instance GHC.Generics.Generic Language.Wasm.Structure.Import
instance GHC.Classes.Eq Language.Wasm.Structure.Import
instance GHC.Show.Show Language.Wasm.Structure.Import
instance Control.DeepSeq.NFData Language.Wasm.Structure.ImportDesc
instance GHC.Generics.Generic Language.Wasm.Structure.ImportDesc
instance GHC.Classes.Eq Language.Wasm.Structure.ImportDesc
instance GHC.Show.Show Language.Wasm.Structure.ImportDesc
instance Control.DeepSeq.NFData Language.Wasm.Structure.Export
instance GHC.Generics.Generic Language.Wasm.Structure.Export
instance GHC.Classes.Eq Language.Wasm.Structure.Export
instance GHC.Show.Show Language.Wasm.Structure.Export
instance Control.DeepSeq.NFData Language.Wasm.Structure.ExportDesc
instance GHC.Generics.Generic Language.Wasm.Structure.ExportDesc
instance GHC.Classes.Eq Language.Wasm.Structure.ExportDesc
instance GHC.Show.Show Language.Wasm.Structure.ExportDesc
instance Control.DeepSeq.NFData Language.Wasm.Structure.StartFunction
instance GHC.Generics.Generic Language.Wasm.Structure.StartFunction
instance GHC.Classes.Eq Language.Wasm.Structure.StartFunction
instance GHC.Show.Show Language.Wasm.Structure.StartFunction
instance Control.DeepSeq.NFData Language.Wasm.Structure.DataSegment
instance GHC.Generics.Generic Language.Wasm.Structure.DataSegment
instance GHC.Classes.Eq Language.Wasm.Structure.DataSegment
instance GHC.Show.Show Language.Wasm.Structure.DataSegment
instance Control.DeepSeq.NFData Language.Wasm.Structure.ElemSegment
instance GHC.Generics.Generic Language.Wasm.Structure.ElemSegment
instance GHC.Classes.Eq Language.Wasm.Structure.ElemSegment
instance GHC.Show.Show Language.Wasm.Structure.ElemSegment
instance Control.DeepSeq.NFData Language.Wasm.Structure.Global
instance GHC.Generics.Generic Language.Wasm.Structure.Global
instance GHC.Classes.Eq Language.Wasm.Structure.Global
instance GHC.Show.Show Language.Wasm.Structure.Global
instance Control.DeepSeq.NFData Language.Wasm.Structure.GlobalType
instance GHC.Generics.Generic Language.Wasm.Structure.GlobalType
instance GHC.Classes.Eq Language.Wasm.Structure.GlobalType
instance GHC.Show.Show Language.Wasm.Structure.GlobalType
instance Control.DeepSeq.NFData Language.Wasm.Structure.Memory
instance GHC.Generics.Generic Language.Wasm.Structure.Memory
instance GHC.Classes.Eq Language.Wasm.Structure.Memory
instance GHC.Show.Show Language.Wasm.Structure.Memory
instance Control.DeepSeq.NFData Language.Wasm.Structure.Table
instance GHC.Generics.Generic Language.Wasm.Structure.Table
instance GHC.Classes.Eq Language.Wasm.Structure.Table
instance GHC.Show.Show Language.Wasm.Structure.Table
instance Control.DeepSeq.NFData Language.Wasm.Structure.TableType
instance GHC.Generics.Generic Language.Wasm.Structure.TableType
instance GHC.Classes.Eq Language.Wasm.Structure.TableType
instance GHC.Show.Show Language.Wasm.Structure.TableType
instance Control.DeepSeq.NFData Language.Wasm.Structure.ElemType
instance GHC.Generics.Generic Language.Wasm.Structure.ElemType
instance GHC.Classes.Eq Language.Wasm.Structure.ElemType
instance GHC.Show.Show Language.Wasm.Structure.ElemType
instance Control.DeepSeq.NFData Language.Wasm.Structure.Limit
instance GHC.Generics.Generic Language.Wasm.Structure.Limit
instance GHC.Classes.Eq Language.Wasm.Structure.Limit
instance GHC.Show.Show Language.Wasm.Structure.Limit
instance Control.DeepSeq.NFData Language.Wasm.Structure.Function
instance GHC.Generics.Generic Language.Wasm.Structure.Function
instance GHC.Classes.Eq Language.Wasm.Structure.Function
instance GHC.Show.Show Language.Wasm.Structure.Function
instance Control.DeepSeq.NFData index => Control.DeepSeq.NFData (Language.Wasm.Structure.Instruction index)
instance GHC.Generics.Generic (Language.Wasm.Structure.Instruction index)
instance GHC.Classes.Eq index => GHC.Classes.Eq (Language.Wasm.Structure.Instruction index)
instance GHC.Show.Show index => GHC.Show.Show (Language.Wasm.Structure.Instruction index)
instance Control.DeepSeq.NFData Language.Wasm.Structure.FuncType
instance GHC.Generics.Generic Language.Wasm.Structure.FuncType
instance GHC.Classes.Eq Language.Wasm.Structure.FuncType
instance GHC.Show.Show Language.Wasm.Structure.FuncType
instance Control.DeepSeq.NFData Language.Wasm.Structure.ValueType
instance GHC.Generics.Generic Language.Wasm.Structure.ValueType
instance GHC.Classes.Eq Language.Wasm.Structure.ValueType
instance GHC.Show.Show Language.Wasm.Structure.ValueType
instance Control.DeepSeq.NFData Language.Wasm.Structure.MemArg
instance GHC.Generics.Generic Language.Wasm.Structure.MemArg
instance GHC.Classes.Eq Language.Wasm.Structure.MemArg
instance GHC.Show.Show Language.Wasm.Structure.MemArg
instance Control.DeepSeq.NFData Language.Wasm.Structure.FRelOp
instance GHC.Generics.Generic Language.Wasm.Structure.FRelOp
instance GHC.Classes.Eq Language.Wasm.Structure.FRelOp
instance GHC.Show.Show Language.Wasm.Structure.FRelOp
instance Control.DeepSeq.NFData Language.Wasm.Structure.FBinOp
instance GHC.Generics.Generic Language.Wasm.Structure.FBinOp
instance GHC.Classes.Eq Language.Wasm.Structure.FBinOp
instance GHC.Show.Show Language.Wasm.Structure.FBinOp
instance Control.DeepSeq.NFData Language.Wasm.Structure.FUnOp
instance GHC.Generics.Generic Language.Wasm.Structure.FUnOp
instance GHC.Classes.Eq Language.Wasm.Structure.FUnOp
instance GHC.Show.Show Language.Wasm.Structure.FUnOp
instance Control.DeepSeq.NFData Language.Wasm.Structure.IRelOp
instance GHC.Generics.Generic Language.Wasm.Structure.IRelOp
instance GHC.Classes.Eq Language.Wasm.Structure.IRelOp
instance GHC.Show.Show Language.Wasm.Structure.IRelOp
instance Control.DeepSeq.NFData Language.Wasm.Structure.IBinOp
instance GHC.Generics.Generic Language.Wasm.Structure.IBinOp
instance GHC.Classes.Eq Language.Wasm.Structure.IBinOp
instance GHC.Show.Show Language.Wasm.Structure.IBinOp
instance Control.DeepSeq.NFData Language.Wasm.Structure.IUnOp
instance GHC.Generics.Generic Language.Wasm.Structure.IUnOp
instance GHC.Classes.Eq Language.Wasm.Structure.IUnOp
instance GHC.Show.Show Language.Wasm.Structure.IUnOp
instance Control.DeepSeq.NFData Language.Wasm.Structure.BitSize
instance GHC.Generics.Generic Language.Wasm.Structure.BitSize
instance GHC.Classes.Eq Language.Wasm.Structure.BitSize
instance GHC.Show.Show Language.Wasm.Structure.BitSize
module Language.Wasm.Parser
parseModule :: [Lexeme] -> Either String Module
parseModuleFields :: [Lexeme] -> Either String [ModuleField]
parseScript :: [Lexeme] -> Either String Script
desugarize :: [ModuleField] -> Either String Module
data ModuleField
MFType :: TypeDef -> ModuleField
MFImport :: Import -> ModuleField
MFFunc :: Function -> ModuleField
MFTable :: Table -> ModuleField
MFMem :: Memory -> ModuleField
MFGlobal :: Global -> ModuleField
MFExport :: Export -> ModuleField
MFStart :: StartFunction -> ModuleField
MFElem :: ElemSegment -> ModuleField
MFData :: DataSegment -> ModuleField
data DataSegment
DataSegment :: MemoryIndex -> [Instruction] -> ByteString -> DataSegment
[$sel:memIndex:DataSegment] :: DataSegment -> MemoryIndex
[$sel:offset:DataSegment] :: DataSegment -> [Instruction]
[$sel:datastring:DataSegment] :: DataSegment -> ByteString
data ElemSegment
ElemSegment :: TableIndex -> [Instruction] -> [FuncIndex] -> ElemSegment
[$sel:tableIndex:ElemSegment] :: ElemSegment -> TableIndex
[$sel:offset:ElemSegment] :: ElemSegment -> [Instruction]
[$sel:funcIndexes:ElemSegment] :: ElemSegment -> [FuncIndex]
data StartFunction
StartFunction :: FuncIndex -> StartFunction
data Export
Export :: Text -> ExportDesc -> Export
[$sel:name:Export] :: Export -> Text
[$sel:desc:Export] :: Export -> ExportDesc
data ExportDesc
ExportFunc :: FuncIndex -> ExportDesc
ExportTable :: TableIndex -> ExportDesc
ExportMemory :: MemoryIndex -> ExportDesc
ExportGlobal :: GlobalIndex -> ExportDesc
data Table
Table :: [Text] -> (Maybe Ident) -> TableType -> Table
data Memory
Memory :: [Text] -> (Maybe Ident) -> Limit -> Memory
data Global
Global :: [Text] -> Maybe Ident -> GlobalType -> [Instruction] -> Global
[$sel:exportGlobalAs:Global] :: Global -> [Text]
[$sel:ident:Global] :: Global -> Maybe Ident
[$sel:globalType:Global] :: Global -> GlobalType
[$sel:initializer:Global] :: Global -> [Instruction]
data Function
Function :: [Text] -> Maybe Ident -> TypeUse -> [LocalType] -> [Instruction] -> Function
[$sel:exportFuncAs:Function] :: Function -> [Text]
[$sel:ident:Function] :: Function -> Maybe Ident
[$sel:funcType:Function] :: Function -> TypeUse
[$sel:locals:Function] :: Function -> [LocalType]
[$sel:body:Function] :: Function -> [Instruction]
data LocalType
LocalType :: Maybe Ident -> ValueType -> LocalType
[$sel:ident:LocalType] :: LocalType -> Maybe Ident
[$sel:localType:LocalType] :: LocalType -> ValueType
data Import
Import :: [Text] -> Text -> Text -> ImportDesc -> Import
[$sel:reExportAs:Import] :: Import -> [Text]
[$sel:sourceModule:Import] :: Import -> Text
[$sel:name:Import] :: Import -> Text
[$sel:desc:Import] :: Import -> ImportDesc
data ImportDesc
ImportFunc :: (Maybe Ident) -> TypeUse -> ImportDesc
ImportTable :: (Maybe Ident) -> TableType -> ImportDesc
ImportMemory :: (Maybe Ident) -> Limit -> ImportDesc
ImportGlobal :: (Maybe Ident) -> GlobalType -> ImportDesc
data Instruction
PlainInstr :: PlainInstr -> Instruction
BlockInstr :: Maybe Ident -> [ValueType] -> [Instruction] -> Instruction
[$sel:label:PlainInstr] :: Instruction -> Maybe Ident
[$sel:resultType:PlainInstr] :: Instruction -> [ValueType]
[$sel:body:PlainInstr] :: Instruction -> [Instruction]
LoopInstr :: Maybe Ident -> [ValueType] -> [Instruction] -> Instruction
[$sel:label:PlainInstr] :: Instruction -> Maybe Ident
[$sel:resultType:PlainInstr] :: Instruction -> [ValueType]
[$sel:body:PlainInstr] :: Instruction -> [Instruction]
IfInstr :: Maybe Ident -> [ValueType] -> [Instruction] -> [Instruction] -> Instruction
[$sel:label:PlainInstr] :: Instruction -> Maybe Ident
[$sel:resultType:PlainInstr] :: Instruction -> [ValueType]
[$sel:trueBranch:PlainInstr] :: Instruction -> [Instruction]
[$sel:falseBranch:PlainInstr] :: Instruction -> [Instruction]
data TypeUse
IndexedTypeUse :: TypeIndex -> (Maybe FuncType) -> TypeUse
AnonimousTypeUse :: FuncType -> TypeUse
data TypeDef
TypeDef :: (Maybe Ident) -> FuncType -> TypeDef
data PlainInstr
Unreachable :: PlainInstr
Nop :: PlainInstr
Br :: LabelIndex -> PlainInstr
BrIf :: LabelIndex -> PlainInstr
BrTable :: [LabelIndex] -> LabelIndex -> PlainInstr
Return :: PlainInstr
Call :: FuncIndex -> PlainInstr
CallIndirect :: TypeUse -> PlainInstr
Drop :: PlainInstr
Select :: PlainInstr
GetLocal :: LocalIndex -> PlainInstr
SetLocal :: LocalIndex -> PlainInstr
TeeLocal :: LocalIndex -> PlainInstr
GetGlobal :: GlobalIndex -> PlainInstr
SetGlobal :: GlobalIndex -> PlainInstr
I32Load :: MemArg -> PlainInstr
I64Load :: MemArg -> PlainInstr
F32Load :: MemArg -> PlainInstr
F64Load :: MemArg -> PlainInstr
I32Load8S :: MemArg -> PlainInstr
I32Load8U :: MemArg -> PlainInstr
I32Load16S :: MemArg -> PlainInstr
I32Load16U :: MemArg -> PlainInstr
I64Load8S :: MemArg -> PlainInstr
I64Load8U :: MemArg -> PlainInstr
I64Load16S :: MemArg -> PlainInstr
I64Load16U :: MemArg -> PlainInstr
I64Load32S :: MemArg -> PlainInstr
I64Load32U :: MemArg -> PlainInstr
I32Store :: MemArg -> PlainInstr
I64Store :: MemArg -> PlainInstr
F32Store :: MemArg -> PlainInstr
F64Store :: MemArg -> PlainInstr
I32Store8 :: MemArg -> PlainInstr
I32Store16 :: MemArg -> PlainInstr
I64Store8 :: MemArg -> PlainInstr
I64Store16 :: MemArg -> PlainInstr
I64Store32 :: MemArg -> PlainInstr
CurrentMemory :: PlainInstr
GrowMemory :: PlainInstr
I32Const :: Integer -> PlainInstr
I64Const :: Integer -> PlainInstr
F32Const :: Float -> PlainInstr
F64Const :: Double -> PlainInstr
IUnOp :: BitSize -> IUnOp -> PlainInstr
IBinOp :: BitSize -> IBinOp -> PlainInstr
I32Eqz :: PlainInstr
I64Eqz :: PlainInstr
IRelOp :: BitSize -> IRelOp -> PlainInstr
FUnOp :: BitSize -> FUnOp -> PlainInstr
FBinOp :: BitSize -> FBinOp -> PlainInstr
FRelOp :: BitSize -> FRelOp -> PlainInstr
I32WrapI64 :: PlainInstr
ITruncFU :: BitSize -> BitSize -> PlainInstr
ITruncFS :: BitSize -> BitSize -> PlainInstr
I64ExtendSI32 :: PlainInstr
I64ExtendUI32 :: PlainInstr
FConvertIU :: BitSize -> BitSize -> PlainInstr
FConvertIS :: BitSize -> BitSize -> PlainInstr
F32DemoteF64 :: PlainInstr
F64PromoteF32 :: PlainInstr
IReinterpretF :: BitSize -> PlainInstr
FReinterpretI :: BitSize -> PlainInstr
data Index
Named :: Ident -> Index
Index :: Natural -> Index
newtype Ident
Ident :: Text -> Ident
data ParamType
ParamType :: Maybe Ident -> ValueType -> ParamType
[$sel:ident:ParamType] :: ParamType -> Maybe Ident
[$sel:paramType:ParamType] :: ParamType -> ValueType
data FuncType
FuncType :: [ParamType] -> [ValueType] -> FuncType
[$sel:params:FuncType] :: FuncType -> [ParamType]
[$sel:results:FuncType] :: FuncType -> [ValueType]
type Script = [Command]
data ModuleDef
RawModDef :: (Maybe Ident) -> Module -> ModuleDef
TextModDef :: (Maybe Ident) -> Text -> ModuleDef
BinaryModDef :: (Maybe Ident) -> ByteString -> ModuleDef
data Command
ModuleDef :: ModuleDef -> Command
Register :: Text -> (Maybe Ident) -> Command
Action :: Action -> Command
Assertion :: Assertion -> Command
Meta :: Meta -> Command
data Action
Invoke :: (Maybe Ident) -> Text -> [Expression] -> Action
Get :: (Maybe Ident) -> Text -> Action
data Assertion
AssertReturn :: Action -> [Expression] -> Assertion
AssertReturnCanonicalNaN :: Action -> Assertion
AssertReturnArithmeticNaN :: Action -> Assertion
AssertTrap :: (Either Action ModuleDef) -> FailureString -> Assertion
AssertMalformed :: ModuleDef -> FailureString -> Assertion
AssertInvalid :: ModuleDef -> FailureString -> Assertion
AssertUnlinkable :: ModuleDef -> FailureString -> Assertion
AssertExhaustion :: Action -> FailureString -> Assertion
data Meta
Script :: (Maybe Ident) -> Script -> Meta
Input :: (Maybe Ident) -> Text -> Meta
Output :: (Maybe Ident) -> Text -> Meta
instance GHC.Show.Show Language.Wasm.Parser.FunCtx
instance GHC.Classes.Eq Language.Wasm.Parser.FunCtx
instance GHC.Classes.Eq Language.Wasm.Parser.Command
instance GHC.Show.Show Language.Wasm.Parser.Command
instance GHC.Classes.Eq Language.Wasm.Parser.Meta
instance GHC.Show.Show Language.Wasm.Parser.Meta
instance GHC.Classes.Eq Language.Wasm.Parser.Assertion
instance GHC.Show.Show Language.Wasm.Parser.Assertion
instance GHC.Classes.Eq Language.Wasm.Parser.Action
instance GHC.Show.Show Language.Wasm.Parser.Action
instance GHC.Classes.Eq Language.Wasm.Parser.ModuleDef
instance GHC.Show.Show Language.Wasm.Parser.ModuleDef
instance GHC.Classes.Eq Language.Wasm.Parser.Module
instance GHC.Show.Show Language.Wasm.Parser.Module
instance Control.DeepSeq.NFData Language.Wasm.Parser.ModuleField
instance GHC.Generics.Generic Language.Wasm.Parser.ModuleField
instance GHC.Classes.Eq Language.Wasm.Parser.ModuleField
instance GHC.Show.Show Language.Wasm.Parser.ModuleField
instance Control.DeepSeq.NFData Language.Wasm.Parser.DataSegment
instance GHC.Generics.Generic Language.Wasm.Parser.DataSegment
instance GHC.Classes.Eq Language.Wasm.Parser.DataSegment
instance GHC.Show.Show Language.Wasm.Parser.DataSegment
instance Control.DeepSeq.NFData Language.Wasm.Parser.ElemSegment
instance GHC.Generics.Generic Language.Wasm.Parser.ElemSegment
instance GHC.Classes.Eq Language.Wasm.Parser.ElemSegment
instance GHC.Show.Show Language.Wasm.Parser.ElemSegment
instance Control.DeepSeq.NFData Language.Wasm.Parser.StartFunction
instance GHC.Generics.Generic Language.Wasm.Parser.StartFunction
instance GHC.Classes.Eq Language.Wasm.Parser.StartFunction
instance GHC.Show.Show Language.Wasm.Parser.StartFunction
instance Control.DeepSeq.NFData Language.Wasm.Parser.Export
instance GHC.Generics.Generic Language.Wasm.Parser.Export
instance GHC.Classes.Eq Language.Wasm.Parser.Export
instance GHC.Show.Show Language.Wasm.Parser.Export
instance Control.DeepSeq.NFData Language.Wasm.Parser.ExportDesc
instance GHC.Generics.Generic Language.Wasm.Parser.ExportDesc
instance GHC.Classes.Eq Language.Wasm.Parser.ExportDesc
instance GHC.Show.Show Language.Wasm.Parser.ExportDesc
instance Control.DeepSeq.NFData Language.Wasm.Parser.Table
instance GHC.Generics.Generic Language.Wasm.Parser.Table
instance GHC.Classes.Eq Language.Wasm.Parser.Table
instance GHC.Show.Show Language.Wasm.Parser.Table
instance Control.DeepSeq.NFData Language.Wasm.Parser.Memory
instance GHC.Generics.Generic Language.Wasm.Parser.Memory
instance GHC.Classes.Eq Language.Wasm.Parser.Memory
instance GHC.Show.Show Language.Wasm.Parser.Memory
instance Control.DeepSeq.NFData Language.Wasm.Parser.Global
instance GHC.Generics.Generic Language.Wasm.Parser.Global
instance GHC.Classes.Eq Language.Wasm.Parser.Global
instance GHC.Show.Show Language.Wasm.Parser.Global
instance Control.DeepSeq.NFData Language.Wasm.Parser.Function
instance GHC.Generics.Generic Language.Wasm.Parser.Function
instance GHC.Classes.Eq Language.Wasm.Parser.Function
instance GHC.Show.Show Language.Wasm.Parser.Function
instance Control.DeepSeq.NFData Language.Wasm.Parser.LocalType
instance GHC.Generics.Generic Language.Wasm.Parser.LocalType
instance GHC.Classes.Eq Language.Wasm.Parser.LocalType
instance GHC.Show.Show Language.Wasm.Parser.LocalType
instance Control.DeepSeq.NFData Language.Wasm.Parser.Import
instance GHC.Generics.Generic Language.Wasm.Parser.Import
instance GHC.Classes.Eq Language.Wasm.Parser.Import
instance GHC.Show.Show Language.Wasm.Parser.Import
instance Control.DeepSeq.NFData Language.Wasm.Parser.ImportDesc
instance GHC.Generics.Generic Language.Wasm.Parser.ImportDesc
instance GHC.Classes.Eq Language.Wasm.Parser.ImportDesc
instance GHC.Show.Show Language.Wasm.Parser.ImportDesc
instance Control.DeepSeq.NFData Language.Wasm.Parser.Instruction
instance GHC.Generics.Generic Language.Wasm.Parser.Instruction
instance GHC.Classes.Eq Language.Wasm.Parser.Instruction
instance GHC.Show.Show Language.Wasm.Parser.Instruction
instance Control.DeepSeq.NFData Language.Wasm.Parser.PlainInstr
instance GHC.Generics.Generic Language.Wasm.Parser.PlainInstr
instance GHC.Classes.Eq Language.Wasm.Parser.PlainInstr
instance GHC.Show.Show Language.Wasm.Parser.PlainInstr
instance Control.DeepSeq.NFData Language.Wasm.Parser.TypeUse
instance GHC.Generics.Generic Language.Wasm.Parser.TypeUse
instance GHC.Classes.Eq Language.Wasm.Parser.TypeUse
instance GHC.Show.Show Language.Wasm.Parser.TypeUse
instance Control.DeepSeq.NFData Language.Wasm.Parser.TypeDef
instance GHC.Generics.Generic Language.Wasm.Parser.TypeDef
instance GHC.Classes.Eq Language.Wasm.Parser.TypeDef
instance GHC.Show.Show Language.Wasm.Parser.TypeDef
instance Control.DeepSeq.NFData Language.Wasm.Parser.Index
instance GHC.Generics.Generic Language.Wasm.Parser.Index
instance GHC.Classes.Eq Language.Wasm.Parser.Index
instance GHC.Show.Show Language.Wasm.Parser.Index
instance Control.DeepSeq.NFData Language.Wasm.Parser.FuncType
instance GHC.Generics.Generic Language.Wasm.Parser.FuncType
instance GHC.Classes.Eq Language.Wasm.Parser.FuncType
instance GHC.Show.Show Language.Wasm.Parser.FuncType
instance Control.DeepSeq.NFData Language.Wasm.Parser.ParamType
instance GHC.Generics.Generic Language.Wasm.Parser.ParamType
instance GHC.Classes.Eq Language.Wasm.Parser.ParamType
instance GHC.Show.Show Language.Wasm.Parser.ParamType
instance Control.DeepSeq.NFData Language.Wasm.Parser.Ident
instance GHC.Generics.Generic Language.Wasm.Parser.Ident
instance GHC.Classes.Eq Language.Wasm.Parser.Ident
instance GHC.Show.Show Language.Wasm.Parser.Ident
module Language.Wasm.Builder
type GenMod = State GenModState
genMod :: GenMod a -> Module
global :: (ValueTypeable t) => (ValueType -> GlobalType) -> Proxy t -> (ValType t) -> GenMod (Glob t)
typedef :: (Returnable res) => res -> [ValueType] -> GenMod (TypeDef res)
fun :: (Returnable res) => res -> GenFun res -> GenMod (Fn res)
funRec :: (Returnable res) => res -> (Fn res -> GenFun res) -> GenMod (Fn res)
declare :: (Returnable res) => res -> [ValueType] -> GenMod (Fn res)
implement :: (Returnable res) => Fn res -> GenFun res -> GenMod (Fn res)
table :: Natural -> Maybe Natural -> GenMod Tbl
memory :: Natural -> Maybe Natural -> GenMod Mem
dataSegment :: (Producer offset, OutType offset ~ Proxy I32) => offset -> ByteString -> GenMod ()
importFunction :: (Returnable res) => Text -> Text -> res -> [ValueType] -> GenMod (Fn res)
importGlobal :: (ValueTypeable t) => Text -> Text -> Proxy t -> GenMod (Glob t)
importMemory :: Text -> Text -> Natural -> Maybe Natural -> GenMod Mem
importTable :: Text -> Text -> Natural -> Maybe Natural -> GenMod Tbl
export :: Exportable e => Text -> e -> GenMod (AfterExport e)
nextFuncIndex :: GenMod Natural
setGlobalInitializer :: forall t. (ValueTypeable t) => Glob t -> (ValType t) -> GenMod ()
type GenFun = ReaderT Natural (State FuncDef)
data Glob t
data Loc t
newtype Fn a
Fn :: Natural -> Fn a
data Mem
data Tbl
data Label i
param :: (ValueTypeable t) => Proxy t -> GenFun (Loc t)
local :: (ValueTypeable t) => Proxy t -> GenFun (Loc t)
label :: GenFun (Label t)
ret :: (Producer expr) => expr -> GenFun (OutType expr)
arg :: (Producer expr) => expr -> GenFun ()
i32 :: Proxy ValueType I32
i64 :: Proxy ValueType I64
f32 :: Proxy ValueType F32
f64 :: Proxy ValueType F64
i32c :: (Integral i) => i -> GenFun (Proxy I32)
i64c :: (Integral i) => i -> GenFun (Proxy I64)
f32c :: Float -> GenFun (Proxy F32)
f64c :: Double -> GenFun (Proxy F64)
add :: (Producer a, Producer b, OutType a ~ OutType b) => a -> b -> GenFun (OutType a)
inc :: (Consumer a, Producer a, Integral i) => i -> a -> GenFun ()
sub :: (Producer a, Producer b, OutType a ~ OutType b) => a -> b -> GenFun (OutType a)
dec :: (Consumer a, Producer a, Integral i) => i -> a -> GenFun ()
mul :: (Producer a, Producer b, OutType a ~ OutType b) => a -> b -> GenFun (OutType a)
div_u :: (Producer a, Producer b, OutType a ~ OutType b, IsInt (OutType a) ~ True) => a -> b -> GenFun (OutType a)
div_s :: (Producer a, Producer b, OutType a ~ OutType b, IsInt (OutType a) ~ True) => a -> b -> GenFun (OutType a)
rem_u :: (Producer a, Producer b, OutType a ~ OutType b, IsInt (OutType a) ~ True) => a -> b -> GenFun (OutType a)
rem_s :: (Producer a, Producer b, OutType a ~ OutType b, IsInt (OutType a) ~ True) => a -> b -> GenFun (OutType a)
and :: (Producer a, Producer b, OutType a ~ OutType b, IsInt (OutType a) ~ True) => a -> b -> GenFun (OutType a)
or :: (Producer a, Producer b, OutType a ~ OutType b, IsInt (OutType a) ~ True) => a -> b -> GenFun (OutType a)
xor :: (Producer a, Producer b, OutType a ~ OutType b, IsInt (OutType a) ~ True) => a -> b -> GenFun (OutType a)
shl :: (Producer a, Producer b, OutType a ~ OutType b, IsInt (OutType a) ~ True) => a -> b -> GenFun (OutType a)
shr_u :: (Producer a, Producer b, OutType a ~ OutType b, IsInt (OutType a) ~ True) => a -> b -> GenFun (OutType a)
shr_s :: (Producer a, Producer b, OutType a ~ OutType b, IsInt (OutType a) ~ True) => a -> b -> GenFun (OutType a)
rotl :: (Producer a, Producer b, OutType a ~ OutType b, IsInt (OutType a) ~ True) => a -> b -> GenFun (OutType a)
rotr :: (Producer a, Producer b, OutType a ~ OutType b, IsInt (OutType a) ~ True) => a -> b -> GenFun (OutType a)
clz :: (Producer a, IsInt (OutType a) ~ True) => a -> GenFun (OutType a)
ctz :: (Producer a, IsInt (OutType a) ~ True) => a -> GenFun (OutType a)
popcnt :: (Producer a, IsInt (OutType a) ~ True) => a -> GenFun (OutType a)
eq :: (Producer a, Producer b, OutType a ~ OutType b) => a -> b -> GenFun (Proxy I32)
ne :: (Producer a, Producer b, OutType a ~ OutType b) => a -> b -> GenFun (Proxy I32)
lt_s :: (Producer a, Producer b, OutType a ~ OutType b, IsInt (OutType a) ~ True) => a -> b -> GenFun (Proxy I32)
lt_u :: (Producer a, Producer b, OutType a ~ OutType b, IsInt (OutType a) ~ True) => a -> b -> GenFun (Proxy I32)
gt_s :: (Producer a, Producer b, OutType a ~ OutType b, IsInt (OutType a) ~ True) => a -> b -> GenFun (Proxy I32)
gt_u :: (Producer a, Producer b, OutType a ~ OutType b, IsInt (OutType a) ~ True) => a -> b -> GenFun (Proxy I32)
le_s :: (Producer a, Producer b, OutType a ~ OutType b, IsInt (OutType a) ~ True) => a -> b -> GenFun (Proxy I32)
le_u :: (Producer a, Producer b, OutType a ~ OutType b, IsInt (OutType a) ~ True) => a -> b -> GenFun (Proxy I32)
ge_s :: (Producer a, Producer b, OutType a ~ OutType b, IsInt (OutType a) ~ True) => a -> b -> GenFun (Proxy I32)
ge_u :: (Producer a, Producer b, OutType a ~ OutType b, IsInt (OutType a) ~ True) => a -> b -> GenFun (Proxy I32)
eqz :: (Producer a, IsInt (OutType a) ~ True) => a -> GenFun (Proxy I32)
div_f :: (Producer a, Producer b, OutType a ~ OutType b, IsFloat (OutType a) ~ True) => a -> b -> GenFun (OutType a)
min_f :: (Producer a, Producer b, OutType a ~ OutType b, IsFloat (OutType a) ~ True) => a -> b -> GenFun (OutType a)
max_f :: (Producer a, Producer b, OutType a ~ OutType b, IsFloat (OutType a) ~ True) => a -> b -> GenFun (OutType a)
copySign :: (Producer a, Producer b, OutType a ~ OutType b, IsFloat (OutType a) ~ True) => a -> b -> GenFun (OutType a)
abs_f :: (Producer a, IsFloat (OutType a) ~ True) => a -> GenFun (OutType a)
neg_f :: (Producer a, IsFloat (OutType a) ~ True) => a -> GenFun (OutType a)
ceil_f :: (Producer a, IsFloat (OutType a) ~ True) => a -> GenFun (OutType a)
floor_f :: (Producer a, IsFloat (OutType a) ~ True) => a -> GenFun (OutType a)
trunc_f :: (Producer a, IsFloat (OutType a) ~ True) => a -> GenFun (OutType a)
nearest_f :: (Producer a, IsFloat (OutType a) ~ True) => a -> GenFun (OutType a)
sqrt_f :: (Producer a, IsFloat (OutType a) ~ True) => a -> GenFun (OutType a)
lt_f :: (Producer a, Producer b, OutType a ~ OutType b, IsFloat (OutType a) ~ True) => a -> b -> GenFun (Proxy I32)
gt_f :: (Producer a, Producer b, OutType a ~ OutType b, IsFloat (OutType a) ~ True) => a -> b -> GenFun (Proxy I32)
le_f :: (Producer a, Producer b, OutType a ~ OutType b, IsFloat (OutType a) ~ True) => a -> b -> GenFun (Proxy I32)
ge_f :: (Producer a, Producer b, OutType a ~ OutType b, IsFloat (OutType a) ~ True) => a -> b -> GenFun (Proxy I32)
wrap :: (Producer i, OutType i ~ Proxy I64) => i -> GenFun (Proxy I32)
trunc_s :: (Producer f, IsFloat (OutType f) ~ True, IsInt (Proxy t) ~ True, ValueTypeable t) => Proxy t -> f -> GenFun (Proxy t)
trunc_u :: (Producer f, IsFloat (OutType f) ~ True, IsInt (Proxy t) ~ True, ValueTypeable t) => Proxy t -> f -> GenFun (Proxy t)
extend_s :: (Producer i, OutType i ~ Proxy I32) => i -> GenFun (Proxy I64)
extend_u :: (Producer i, OutType i ~ Proxy I32) => i -> GenFun (Proxy I64)
convert_s :: (Producer i, IsInt (OutType i) ~ True, IsFloat (Proxy t) ~ True, ValueTypeable t) => Proxy t -> i -> GenFun (Proxy t)
convert_u :: (Producer i, IsInt (OutType i) ~ True, IsFloat (Proxy t) ~ True, ValueTypeable t) => Proxy t -> i -> GenFun (Proxy t)
demote :: (Producer f, OutType f ~ Proxy F64) => f -> GenFun (Proxy F32)
promote :: (Producer f, OutType f ~ Proxy F32) => f -> GenFun (Proxy F64)
reinterpret :: (ValueTypeable t, Producer val, SameSize (Proxy t) (OutType val) ~ True) => Proxy t -> val -> GenFun (Proxy t)
load :: (ValueTypeable t, Producer addr, OutType addr ~ Proxy I32, Integral offset, Integral align) => Proxy t -> addr -> offset -> align -> GenFun (Proxy t)
load8_u :: (ValueTypeable t, IsInt (Proxy t) ~ True, Producer addr, OutType addr ~ Proxy I32, Integral offset, Integral align) => Proxy t -> addr -> offset -> align -> GenFun (Proxy t)
load8_s :: (ValueTypeable t, IsInt (Proxy t) ~ True, Producer addr, OutType addr ~ Proxy I32, Integral offset, Integral align) => Proxy t -> addr -> offset -> align -> GenFun (Proxy t)
load16_u :: (ValueTypeable t, IsInt (Proxy t) ~ True, Producer addr, OutType addr ~ Proxy I32, Integral offset, Integral align) => Proxy t -> addr -> offset -> align -> GenFun (Proxy t)
load16_s :: (ValueTypeable t, IsInt (Proxy t) ~ True, Producer addr, OutType addr ~ Proxy I32, Integral offset, Integral align) => Proxy t -> addr -> offset -> align -> GenFun (Proxy t)
load32_u :: (ValueTypeable t, IsInt (Proxy t) ~ True, Producer addr, OutType addr ~ Proxy I32, Integral offset, Integral align) => Proxy t -> addr -> offset -> align -> GenFun (Proxy t)
load32_s :: (ValueTypeable t, IsInt (Proxy t) ~ True, Producer addr, OutType addr ~ Proxy I32, Integral offset, Integral align) => Proxy t -> addr -> offset -> align -> GenFun (Proxy t)
store :: (Producer addr, OutType addr ~ Proxy I32, Producer val, Integral offset, Integral align) => addr -> val -> offset -> align -> GenFun ()
store8 :: (Producer addr, OutType addr ~ Proxy I32, Producer val, IsInt (OutType val) ~ True, Integral offset, Integral align) => addr -> val -> offset -> align -> GenFun ()
store16 :: (Producer addr, OutType addr ~ Proxy I32, Producer val, IsInt (OutType val) ~ True, Integral offset, Integral align) => addr -> val -> offset -> align -> GenFun ()
store32 :: (Producer addr, OutType addr ~ Proxy I32, Producer val, OutType val ~ Proxy I64, Integral offset, Integral align) => addr -> val -> offset -> align -> GenFun ()
memorySize :: GenFun (Proxy I32)
growMemory :: (Producer size, OutType size ~ Proxy I32) => size -> GenFun ()
nop :: GenFun ()
drop :: (Producer val) => val -> GenFun ()
select :: (Producer a, Producer b, OutType a ~ OutType b, Producer pred, OutType pred ~ Proxy I32) => pred -> a -> b -> GenFun (OutType a)
call :: (Returnable res) => Fn res -> [GenFun a] -> GenFun res
callIndirect :: (Producer index, OutType index ~ Proxy I32, Returnable res) => TypeDef res -> index -> [GenFun a] -> GenFun res
finish :: (Producer val) => val -> GenFun ()
br :: Label t -> GenFun ()
brIf :: (Producer pred, OutType pred ~ Proxy I32) => pred -> Label t -> GenFun ()
brTable :: (Producer selector, OutType selector ~ Proxy I32) => selector -> [Label t] -> Label t -> GenFun ()
if' :: (Producer pred, OutType pred ~ Proxy I32, Returnable res) => res -> pred -> GenFun res -> GenFun res -> GenFun res
loop :: (Returnable res) => res -> GenFun res -> GenFun res
block :: (Returnable res) => res -> GenFun res -> GenFun res
when :: (Producer pred, OutType pred ~ Proxy I32) => pred -> GenFun () -> GenFun ()
for :: (Producer pred, OutType pred ~ Proxy I32) => GenFun () -> pred -> GenFun () -> GenFun () -> GenFun ()
while :: (Producer pred, OutType pred ~ Proxy I32) => pred -> GenFun () -> GenFun ()
trap :: Proxy t -> GenFun (Proxy t)
unreachable :: GenFun ()
appendExpr :: Expression -> GenFun ()
after :: Expression -> GenFun a -> GenFun a
class Producer expr where {
type family OutType expr;
}
produce :: Producer expr => expr -> GenFun (OutType expr)
produce :: Producer expr => expr -> GenFun (OutType expr)
class Consumer loc
(.=) :: (Consumer loc, (Producer expr)) => loc -> expr -> GenFun ()
(.=) :: (Consumer loc, (Producer expr)) => loc -> expr -> GenFun ()
infixr 2 .=
instance GHC.Classes.Eq Language.Wasm.Builder.Tbl
instance GHC.Show.Show Language.Wasm.Builder.Tbl
instance GHC.Classes.Eq Language.Wasm.Builder.Mem
instance GHC.Show.Show Language.Wasm.Builder.Mem
instance forall k (t :: k). GHC.Classes.Eq (Language.Wasm.Builder.Glob t)
instance forall k (t :: k). GHC.Show.Show (Language.Wasm.Builder.Glob t)
instance GHC.Classes.Eq Language.Wasm.Builder.GenModState
instance GHC.Show.Show Language.Wasm.Builder.GenModState
instance forall k (a :: k). GHC.Classes.Eq (Language.Wasm.Builder.Fn a)
instance forall k (a :: k). GHC.Show.Show (Language.Wasm.Builder.Fn a)
instance forall k (t :: k). GHC.Classes.Eq (Language.Wasm.Builder.TypeDef t)
instance forall k (t :: k). GHC.Show.Show (Language.Wasm.Builder.TypeDef t)
instance forall k (i :: k). GHC.Classes.Eq (Language.Wasm.Builder.Label i)
instance forall k (i :: k). GHC.Show.Show (Language.Wasm.Builder.Label i)
instance forall k (t :: k). GHC.Classes.Eq (Language.Wasm.Builder.Loc t)
instance forall k (t :: k). GHC.Show.Show (Language.Wasm.Builder.Loc t)
instance GHC.Classes.Eq Language.Wasm.Builder.FuncDef
instance GHC.Show.Show Language.Wasm.Builder.FuncDef
instance Language.Wasm.Builder.Exportable Language.Wasm.Builder.Tbl
instance Language.Wasm.Builder.Exportable Language.Wasm.Builder.Mem
instance forall k (t :: k). Language.Wasm.Builder.ValueTypeable t => Language.Wasm.Builder.Producer (Language.Wasm.Builder.Glob t)
instance forall k (t :: k). Language.Wasm.Builder.Consumer (Language.Wasm.Builder.Glob t)
instance forall k (t :: k). Language.Wasm.Builder.Exportable (Language.Wasm.Builder.Glob t)
instance forall k (t :: k). Language.Wasm.Builder.ValueTypeable t => Language.Wasm.Builder.Producer (Language.Wasm.Builder.Loc t)
instance forall k (t :: k). Language.Wasm.Builder.ValueTypeable t => Language.Wasm.Builder.Producer (Language.Wasm.Builder.GenFun (Data.Proxy.Proxy t))
instance forall k (t :: k). Language.Wasm.Builder.ValueTypeable t => Language.Wasm.Builder.Returnable (Data.Proxy.Proxy t)
instance Language.Wasm.Builder.ValueTypeable 'Language.Wasm.Structure.I32
instance Language.Wasm.Builder.ValueTypeable 'Language.Wasm.Structure.I64
instance Language.Wasm.Builder.ValueTypeable 'Language.Wasm.Structure.F32
instance Language.Wasm.Builder.ValueTypeable 'Language.Wasm.Structure.F64
instance Language.Wasm.Builder.Exportable e => Language.Wasm.Builder.Exportable (Language.Wasm.Builder.GenMod e)
instance forall k (t :: k). Language.Wasm.Builder.Exportable (Language.Wasm.Builder.Fn t)
instance Language.Wasm.Builder.Returnable ()
instance forall k (t :: k). Language.Wasm.Builder.Consumer (Language.Wasm.Builder.Loc t)
module Language.Wasm.Binary
dumpModule :: Module -> ByteString
dumpModuleLazy :: Module -> ByteString
decodeModule :: ByteString -> Either String Module
decodeModuleLazy :: ByteString -> Either String Module
instance GHC.Classes.Eq Language.Wasm.Binary.LocalTypeRange
instance GHC.Show.Show Language.Wasm.Binary.LocalTypeRange
instance GHC.Classes.Eq Language.Wasm.Binary.Index
instance GHC.Show.Show Language.Wasm.Binary.Index
instance GHC.Enum.Enum Language.Wasm.Binary.SectionType
instance GHC.Show.Show Language.Wasm.Binary.SectionType
instance GHC.Classes.Eq Language.Wasm.Binary.SectionType
instance Data.Serialize.Serialize Language.Wasm.Binary.LocalTypeRange
instance Data.Serialize.Serialize Language.Wasm.Structure.Function
instance Data.Serialize.Serialize Language.Wasm.Binary.Index
instance Data.Serialize.Serialize (Language.Wasm.Structure.Instruction GHC.Natural.Natural)
instance Data.Serialize.Serialize Language.Wasm.Structure.ElemSegment
instance Data.Serialize.Serialize Language.Wasm.Structure.Module
instance Data.Serialize.Serialize Language.Wasm.Binary.SectionType
instance Data.Serialize.Serialize Language.Wasm.Structure.ValueType
instance Data.Serialize.Serialize Language.Wasm.Structure.FuncType
instance Data.Serialize.Serialize Language.Wasm.Structure.ElemType
instance Data.Serialize.Serialize Language.Wasm.Structure.Limit
instance Data.Serialize.Serialize Language.Wasm.Structure.TableType
instance Data.Serialize.Serialize Language.Wasm.Structure.GlobalType
instance Data.Serialize.Serialize Language.Wasm.Structure.ImportDesc
instance Data.Serialize.Serialize Language.Wasm.Structure.Import
instance Data.Serialize.Serialize Language.Wasm.Structure.Table
instance Data.Serialize.Serialize Language.Wasm.Structure.Memory
instance Data.Serialize.Serialize Language.Wasm.Structure.MemArg
instance Data.Serialize.Serialize Language.Wasm.Structure.Global
instance Data.Serialize.Serialize Language.Wasm.Structure.ExportDesc
instance Data.Serialize.Serialize Language.Wasm.Structure.Export
instance Data.Serialize.Serialize Language.Wasm.Structure.DataSegment
module Language.Wasm.Validate
data ValidationError
DuplicatedExportNames :: [String] -> ValidationError
InvalidTableType :: ValidationError
MinMoreThanMaxInMemoryLimit :: ValidationError
MemoryLimitExceeded :: ValidationError
AlignmentOverflow :: ValidationError
MoreThanOneMemory :: ValidationError
MoreThanOneTable :: ValidationError
FunctionIndexOutOfRange :: ValidationError
TableIndexOutOfRange :: ValidationError
MemoryIndexOutOfRange :: ValidationError
LocalIndexOutOfRange :: ValidationError
GlobalIndexOutOfRange :: ValidationError
LabelIndexOutOfRange :: ValidationError
TypeIndexOutOfRange :: ValidationError
ResultTypeDoesntMatch :: ValidationError
TypeMismatch :: Arrow -> Arrow -> ValidationError
[$sel:actual:DuplicatedExportNames] :: ValidationError -> Arrow
[$sel:expected:DuplicatedExportNames] :: ValidationError -> Arrow
InvalidResultArity :: ValidationError
InvalidConstantExpr :: ValidationError
InvalidStartFunctionType :: ValidationError
ImportedGlobalIsNotConst :: ValidationError
ExportedGlobalIsNotConst :: ValidationError
GlobalIsImmutable :: ValidationError
type ValidationResult = Either ValidationError ()
validate :: Module -> Either ValidationError ValidModule
isValid :: ValidationResult -> Bool
data ValidModule
($sel:getModule:ValidModule) :: ValidModule -> Module
instance GHC.Classes.Eq Language.Wasm.Validate.ValidModule
instance GHC.Show.Show Language.Wasm.Validate.ValidModule
instance GHC.Classes.Eq Language.Wasm.Validate.Ctx
instance GHC.Show.Show Language.Wasm.Validate.Ctx
instance GHC.Classes.Eq Language.Wasm.Validate.ValidationError
instance GHC.Show.Show Language.Wasm.Validate.ValidationError
instance GHC.Classes.Eq Language.Wasm.Validate.Arrow
instance GHC.Show.Show Language.Wasm.Validate.Arrow
instance GHC.Classes.Eq Language.Wasm.Validate.VType
instance GHC.Show.Show Language.Wasm.Validate.VType
instance GHC.Base.Monoid Language.Wasm.Validate.ValidationResult
instance Language.Wasm.Validate.ToEnd Language.Wasm.Validate.VType
instance Language.Wasm.Validate.ToEnd Language.Wasm.Structure.ValueType
instance Language.Wasm.Validate.ToEnd [Language.Wasm.Structure.ValueType]
instance Language.Wasm.Validate.ToEnd [Language.Wasm.Validate.VType]
module Language.Wasm.Interpreter
data Value
VI32 :: Word32 -> Value
VI64 :: Word64 -> Value
VF32 :: Float -> Value
VF64 :: Double -> Value
data Store
data ModuleInstance
ModuleInstance :: Vector FuncType -> Vector Address -> Vector Address -> Vector Address -> Vector Address -> Vector ExportInstance -> ModuleInstance
[$sel:funcTypes:ModuleInstance] :: ModuleInstance -> Vector FuncType
[$sel:funcaddrs:ModuleInstance] :: ModuleInstance -> Vector Address
[$sel:tableaddrs:ModuleInstance] :: ModuleInstance -> Vector Address
[$sel:memaddrs:ModuleInstance] :: ModuleInstance -> Vector Address
[$sel:globaladdrs:ModuleInstance] :: ModuleInstance -> Vector Address
[$sel:exports:ModuleInstance] :: ModuleInstance -> Vector ExportInstance
data ExternalValue
ExternFunction :: Address -> ExternalValue
ExternTable :: Address -> ExternalValue
ExternMemory :: Address -> ExternalValue
ExternGlobal :: Address -> ExternalValue
data ExportInstance
ExportInstance :: Text -> ExternalValue -> ExportInstance
data GlobalInstance
GIConst :: ValueType -> Value -> GlobalInstance
GIMut :: ValueType -> (IORef Value) -> GlobalInstance
type Imports = Map (Text, Text) ExternalValue
data HostItem
HostFunction :: FuncType -> HostFunction -> HostItem
HostGlobal :: GlobalInstance -> HostItem
HostMemory :: Limit -> HostItem
HostTable :: Limit -> HostItem
instantiate :: Store -> Imports -> ValidModule -> IO (Either String (ModuleInstance, Store))
invoke :: Store -> Address -> [Value] -> IO (Maybe [Value])
invokeExport :: Store -> ModuleInstance -> Text -> [Value] -> IO (Maybe [Value])
getGlobalValueByName :: Store -> ModuleInstance -> Text -> IO Value
emptyStore :: Store
emptyImports :: Imports
makeHostModule :: Store -> [(Text, HostItem)] -> IO (Store, ModuleInstance)
makeMutGlobal :: Value -> IO GlobalInstance
instance GHC.Classes.Eq Language.Wasm.Interpreter.EvalResult
instance GHC.Show.Show Language.Wasm.Interpreter.EvalResult
instance GHC.Classes.Eq Language.Wasm.Interpreter.EvalCtx
instance GHC.Show.Show Language.Wasm.Interpreter.EvalCtx
instance GHC.Show.Show Language.Wasm.Interpreter.ModuleInstance
instance GHC.Classes.Eq Language.Wasm.Interpreter.ModuleInstance
instance GHC.Show.Show Language.Wasm.Interpreter.ExportInstance
instance GHC.Classes.Eq Language.Wasm.Interpreter.ExportInstance
instance GHC.Show.Show Language.Wasm.Interpreter.ExternalValue
instance GHC.Classes.Eq Language.Wasm.Interpreter.ExternalValue
instance GHC.Classes.Eq Language.Wasm.Interpreter.Label
instance GHC.Show.Show Language.Wasm.Interpreter.Label
instance GHC.Show.Show Language.Wasm.Interpreter.Value
instance GHC.Classes.Eq Language.Wasm.Interpreter.Value
module Language.Wasm.Script
runScript :: OnAssertFail -> Script -> IO ()
type OnAssertFail = String -> Assertion -> IO ()
module Language.Wasm
data Module
data ValidModule
data ValidationError
DuplicatedExportNames :: [String] -> ValidationError
InvalidTableType :: ValidationError
MinMoreThanMaxInMemoryLimit :: ValidationError
MemoryLimitExceeded :: ValidationError
AlignmentOverflow :: ValidationError
MoreThanOneMemory :: ValidationError
MoreThanOneTable :: ValidationError
FunctionIndexOutOfRange :: ValidationError
TableIndexOutOfRange :: ValidationError
MemoryIndexOutOfRange :: ValidationError
LocalIndexOutOfRange :: ValidationError
GlobalIndexOutOfRange :: ValidationError
LabelIndexOutOfRange :: ValidationError
TypeIndexOutOfRange :: ValidationError
ResultTypeDoesntMatch :: ValidationError
TypeMismatch :: Arrow -> Arrow -> ValidationError
[$sel:actual:DuplicatedExportNames] :: ValidationError -> Arrow
[$sel:expected:DuplicatedExportNames] :: ValidationError -> Arrow
InvalidResultArity :: ValidationError
InvalidConstantExpr :: ValidationError
InvalidStartFunctionType :: ValidationError
ImportedGlobalIsNotConst :: ValidationError
ExportedGlobalIsNotConst :: ValidationError
GlobalIsImmutable :: ValidationError
-- | Parse WebAssembly text representation to Module
parse :: ByteString -> Either String Module
validate :: Module -> Either ValidationError ValidModule
-- | Parse WebAssembly extended scipt grammar
parseScript :: ByteString -> Either String Script
-- | Dump Module to binary representation
encode :: Module -> ByteString
-- | Dump Module to binary representation lazily
encodeLazy :: Module -> ByteString
-- | Decode Module from binary representation
decode :: ByteString -> Either String Module
-- | Decode Module from binary representation lazily
decodeLazy :: ByteString -> Either String Module
type Script = [Command]
runScript :: OnAssertFail -> Script -> IO ()