-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Extism bindings -- -- Bindings to Extism, the universal plugin system @package extism @version 1.3.0.0 -- | Extism.Encoding handles how values are encoded to be copied in and out -- of Wasm linear memory module Extism.Encoding -- | Helper function to convert a ByteString to a String fromByteString :: ByteString -> String -- | Helper function to convert a String to a ByteString toByteString :: String -> ByteString -- | Extism error newtype Error ExtismError :: String -> Error -- | Result type type Result a = Either Error a class ToBytes a toBytes :: ToBytes a => a -> ByteString class FromBytes a fromBytes :: FromBytes a => ByteString -> Result a class (ToBytes a, FromBytes a) => Encoding a newtype JSON x JSON :: x -> JSON x instance GHC.Classes.Eq Extism.Encoding.Error instance Extism.Encoding.FromBytes Data.ByteString.Internal.Type.ByteString instance Extism.Encoding.FromBytes GHC.Types.Double instance Extism.Encoding.FromBytes GHC.Types.Float instance Extism.Encoding.FromBytes GHC.Internal.Int.Int32 instance Extism.Encoding.FromBytes GHC.Internal.Int.Int64 instance GHC.Internal.Data.Data.Data a => Extism.Encoding.FromBytes (Extism.Encoding.JSON a) instance Extism.Encoding.FromBytes [GHC.Types.Char] instance Extism.Encoding.FromBytes () instance Extism.Encoding.FromBytes GHC.Internal.Word.Word32 instance Extism.Encoding.FromBytes GHC.Internal.Word.Word64 instance GHC.Internal.Show.Show Extism.Encoding.Error instance Extism.Encoding.ToBytes Data.ByteString.Internal.Type.ByteString instance Extism.Encoding.ToBytes GHC.Types.Double instance Extism.Encoding.ToBytes GHC.Types.Float instance Extism.Encoding.ToBytes GHC.Internal.Int.Int32 instance Extism.Encoding.ToBytes GHC.Internal.Int.Int64 instance GHC.Internal.Data.Data.Data a => Extism.Encoding.ToBytes (Extism.Encoding.JSON a) instance Extism.Encoding.ToBytes [GHC.Types.Char] instance Extism.Encoding.ToBytes () instance Extism.Encoding.ToBytes GHC.Internal.Word.Word32 instance Extism.Encoding.ToBytes GHC.Internal.Word.Word64 -- | A Haskell Extism host -- -- Requires a libextism installation, see -- https://extism.org/docs/install module Extism data Manifest -- | Host function, see hostFunction data Function Function :: ForeignPtr ExtismFunction -> StablePtr () -> Function -- | Plugins can be used to call WASM function newtype Plugin Plugin :: ForeignPtr ExtismPlugin -> Plugin -- | Cancellation handle for Plugins newtype CancelHandle CancelHandle :: Ptr ExtismCancelHandle -> CancelHandle -- | Log level data LogLevel LogError :: LogLevel LogWarn :: LogLevel LogInfo :: LogLevel LogDebug :: LogLevel LogTrace :: LogLevel -- | Extism error newtype Error ExtismError :: String -> Error -- | Result type type Result a = Either Error a -- | Get the Extism version string extismVersion :: () -> IO String -- | Create a Plugin from a WASM module, useWasi determines -- if WASI should | be linked newPlugin :: PluginInput a => a -> [Function] -> Bool -> IO (Result Plugin) -- | Create a Plugin from a WASM module, useWasi determines -- if WASI should | be linked newCompiledPlugin :: PluginInput a => a -> [Function] -> Bool -> IO (Result CompiledPlugin) -- | Create a new plugin from a CompiledPlugin newPluginFromCompiled :: CompiledPlugin -> IO (Result Plugin) -- | Check if a Plugin is valid isValid :: Plugin -> IO Bool -- | Set configuration values for a plugin setConfig :: Plugin -> [(String, Maybe String)] -> IO Bool -- | Set the log file and level, this is a global configuration setLogFile :: String -> LogLevel -> IO Bool -- | Check if a function exists in the given plugin functionExists :: Plugin -> String -> IO Bool call :: (ToBytes a, FromBytes b) => Plugin -> String -> a -> IO (Result b) call' :: (ToBytes a, FromBytes b) => Plugin -> String -> a -> IO b callWithHostContext :: (ToBytes a, FromBytes b) => Plugin -> String -> a -> c -> IO (Result b) callWithHostContext' :: (ToBytes a, FromBytes b) => Plugin -> String -> a -> c -> IO b -- | Create a new CancelHandle that can be used to cancel a running -- plugin | from another thread. cancelHandle :: Plugin -> IO CancelHandle -- | Cancel a running plugin using a CancelHandle cancel :: CancelHandle -> IO Bool pluginID :: Plugin -> IO UUID unwrap :: Either Error b -> b class ToBytes a toBytes :: ToBytes a => a -> ByteString class FromBytes a fromBytes :: FromBytes a => ByteString -> Result a newtype JSON x JSON :: x -> JSON x -- | Defines types that can be used to pass Wasm data into a plugin class PluginInput a pluginInput :: PluginInput a => a -> ByteString reset :: Plugin -> IO () instance GHC.Classes.Eq Extism.CancelHandle instance GHC.Classes.Eq Extism.CompiledPlugin instance GHC.Classes.Eq Extism.Function instance GHC.Classes.Eq Extism.LogLevel instance GHC.Classes.Eq Extism.Plugin instance Extism.PluginInput Data.ByteString.Internal.Type.ByteString instance Extism.PluginInput Extism.Manifest.Manifest instance GHC.Internal.Show.Show Extism.CancelHandle instance GHC.Internal.Show.Show Extism.CompiledPlugin instance GHC.Internal.Show.Show Extism.LogLevel instance GHC.Internal.Show.Show Extism.Plugin module Extism.HostFunction -- | Access the plugin that is currently executing from inside a host -- function data CurrentPlugin CurrentPlugin :: Ptr ExtismCurrentPlugin -> [Val] -> Ptr Val -> Int -> CurrentPlugin -- | Low-level Wasm types data ValType I32 :: ValType I64 :: ValType F32 :: ValType F64 :: ValType V128 :: ValType FuncRef :: ValType ExternRef :: ValType -- | Low-level Wasm values data Val ValI32 :: Int32 -> Val ValI64 :: Int64 -> Val ValF32 :: Float -> Val ValF64 :: Double -> Val -- | A memory handle represents an allocated block of Extism memory data MemoryHandle -- | Host function, see hostFunction data Function -- | Allocate a new handle of the given size memoryAlloc :: CurrentPlugin -> Word64 -> IO MemoryHandle -- | Get the length of a handle, returns 0 if the handle is invalid memoryLength :: CurrentPlugin -> MemoryHandle -> IO Word64 -- | Free allocated memory memoryFree :: CurrentPlugin -> MemoryHandle -> IO () -- | Access a pointer to the entire memory region memory :: CurrentPlugin -> IO (Ptr Word8) -- | Access the pointer for the given MemoryHandle memoryOffset :: CurrentPlugin -> MemoryHandle -> IO (Ptr Word8) -- | Access the data associated with a handle as a ByteString memoryBytes :: CurrentPlugin -> MemoryHandle -> IO ByteString -- | Access the data associated with a handle as a String memoryString :: CurrentPlugin -> MemoryHandle -> IO String -- | Access the data associated with a handle and convert it into a Haskell -- type memoryGet :: FromBytes a => CurrentPlugin -> MemoryHandle -> IO (Result a) -- | Allocate memory and copy an existing ByteString into it allocBytes :: CurrentPlugin -> ByteString -> IO MemoryHandle -- | Allocate memory and copy an existing String into it allocString :: CurrentPlugin -> String -> IO MemoryHandle alloc :: ToBytes a => CurrentPlugin -> a -> IO MemoryHandle -- | Create a new I32 Val toI32 :: Integral a => a -> Val -- | Create a new I64 Val toI64 :: Integral a => a -> Val -- | Create a new F32 Val toF32 :: Float -> Val -- | Create a new F64 Val toF64 :: Double -> Val -- | Get I32 Val fromI32 :: Integral a => Val -> Maybe a -- | Get I64 Val fromI64 :: Integral a => Val -> Maybe a -- | Get F32 Val fromF32 :: Val -> Maybe Float -- | Get F64 Val fromF64 :: Val -> Maybe Double -- | hostFunction "function_name" inputTypes outputTypes callback -- userData creates a new | Function in the default namespace -- that can be called from a Plugin hostFunction :: String -> [ValType] -> [ValType] -> (CurrentPlugin -> a -> IO ()) -> a -> IO Function -- | hostFunction' "namespace" "function_name" inputTypes outputTypes -- callback userData creates a new | Function in the provided -- namespace that can be called from a Plugin hostFunction' :: String -> String -> [ValType] -> [ValType] -> (CurrentPlugin -> a -> IO ()) -> a -> IO Function -- | newFunction' "function_name" inputTypes outputTypes userData -- callback creates a new | Function in the default namespace -- that can be called from a Plugin newFunction :: String -> [ValType] -> [ValType] -> a -> (CurrentPlugin -> a -> IO ()) -> IO Function -- | newFunction' "namespace" "function_name" inputTypes outputTypes -- userData callback creates a new | Function in the provided -- namespace that can be called from a Plugin newFunction' :: String -> String -> [ValType] -> [ValType] -> a -> (CurrentPlugin -> a -> IO ()) -> IO Function input :: FromBytes a => CurrentPlugin -> Int -> IO (Result a) output :: ToBytes a => CurrentPlugin -> Int -> a -> IO () getParams :: CurrentPlugin -> [Val] setResults :: CurrentPlugin -> [Val] -> IO () hostContext :: CurrentPlugin -> IO (Maybe a) ptr :: ValType instance GHC.Internal.Enum.Enum Extism.HostFunction.MemoryHandle instance GHC.Classes.Eq Extism.HostFunction.MemoryHandle instance GHC.Internal.Real.Integral Extism.HostFunction.MemoryHandle instance GHC.Internal.Num.Num Extism.HostFunction.MemoryHandle instance GHC.Classes.Ord Extism.HostFunction.MemoryHandle instance GHC.Internal.Real.Real Extism.HostFunction.MemoryHandle instance GHC.Internal.Show.Show Extism.HostFunction.MemoryHandle