-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | WebAssembly Language Toolkit and Interpreter
--
-- Library for parsing and interpreting WebAssembly, including: *
-- WebAssembly Text Representation Parser * WebAssembly Binary
-- Represetnation encoder and decoder * Spec-compatible Module validator
-- (checked with Spec Core Test Suite) * Spec-compatible Interpreter
-- (checked with Spec Core Test Suite) * Extended scripting grammar
-- parser and executor * WebAssembly Module building eDSL
@package wasm
@version 1.1.0
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
doubleFromInteger :: Integer -> Either String Double
instance GHC.Show.Show Language.Wasm.Lexer.AlexPosn
instance GHC.Classes.Eq Language.Wasm.Lexer.AlexPosn
instance GHC.Classes.Eq Language.Wasm.Lexer.NaN
instance GHC.Show.Show Language.Wasm.Lexer.NaN
instance GHC.Classes.Eq Language.Wasm.Lexer.FloatRep
instance GHC.Show.Show Language.Wasm.Lexer.FloatRep
instance GHC.Classes.Eq Language.Wasm.Lexer.Token
instance GHC.Show.Show Language.Wasm.Lexer.Token
instance GHC.Classes.Eq Language.Wasm.Lexer.Lexeme
instance GHC.Show.Show Language.Wasm.Lexer.Lexeme
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 :: BlockType -> Expression -> Instruction index
[$sel:blockType:Unreachable] :: Instruction index -> BlockType
[$sel:body:Unreachable] :: Instruction index -> Expression
Loop :: BlockType -> Expression -> Instruction index
[$sel:blockType:Unreachable] :: Instruction index -> BlockType
[$sel:body:Unreachable] :: Instruction index -> Expression
If :: BlockType -> Expression -> Expression -> Instruction index
[$sel:blockType:Unreachable] :: Instruction index -> BlockType
[$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
ITruncSatFU :: BitSize -> BitSize -> Instruction index
ITruncSatFS :: 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
IExtend8S :: IUnOp
IExtend16S :: IUnOp
IExtend32S :: 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
FuncRef :: 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
data BlockType
Inline :: Maybe ValueType -> BlockType
TypeIndex :: TypeIndex -> BlockType
type ParamsType = [ValueType]
type ResultType = [ValueType]
type LocalsType = [ValueType]
type Expression = [Instruction Natural]
type LabelIndex = Natural
type FuncIndex = Natural
type TypeIndex = Natural
type LocalIndex = Natural
type GlobalIndex = Natural
type MemoryIndex = Natural
type TableIndex = Natural
emptyModule :: Module
isFuncImport :: Import -> Bool
isTableImport :: Import -> Bool
isMemImport :: Import -> Bool
isGlobalImport :: Import -> Bool
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
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.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.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.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.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.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.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.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.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.BlockType
instance GHC.Generics.Generic Language.Wasm.Structure.BlockType
instance GHC.Classes.Eq Language.Wasm.Structure.BlockType
instance GHC.Show.Show Language.Wasm.Structure.BlockType
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.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 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.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.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.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.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.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.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.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.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.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.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.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.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.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.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
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 :: Natural -> ValidationError
MemoryIndexOutOfRange :: Natural -> ValidationError
LocalIndexOutOfRange :: Natural -> ValidationError
GlobalIndexOutOfRange :: Natural -> 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
GlobalIsImmutable :: ValidationError
-- | Parse WebAssembly text representation to Module
parse :: ByteString -> Either String Module
validate :: Module -> Either ValidationError ValidModule
-- | Parse WebAssembly extended script 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]
data Command
ModuleDef :: ModuleDef -> Command
Register :: Text -> Maybe Ident -> Command
Action :: Action -> Command
Assertion :: Int -> Assertion -> Command
Meta :: Meta -> Command
data ModuleDef
RawModDef :: Maybe Ident -> Module -> ModuleDef
TextModDef :: Maybe Ident -> Text -> ModuleDef
BinaryModDef :: Maybe Ident -> ByteString -> ModuleDef
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
newtype Ident
Ident :: Text -> Ident
data Meta
Script :: Maybe Ident -> Script -> Meta
Input :: Maybe Ident -> Text -> Meta
Output :: Maybe Ident -> Text -> Meta
runScript :: OnAssertFail -> Script -> IO ()
($sel:getModule:ValidModule) :: ValidModule -> Module