extism-pdk-0.2.0.0: Extism Plugin Development Kit
Safe HaskellSafe-Inferred
LanguageHaskell2010

Extism.PDK

Description

Extism plugin development kit, used with the wasm32-wasi-ghc backend to make Extism plugins

Synopsis

Documentation

data LogLevel Source #

Log level

Constructors

Info 
Debug 
Warn 
Error 

log :: LogLevel -> String -> IO () Source #

Log to configured log file

tryInput :: FromBytes a => IO (Either String a) Source #

Get plugin input, returning an error message if the encoding is invalid

inputByteString :: IO ByteString Source #

Get plugin input as a ByteString

input :: forall a. FromBytes a => IO a Source #

Get plugin input

inputString :: IO String Source #

Get plugin input as a String

inputJSON :: JSON a => IO (Either String a) Source #

Get input as JSON, this is similar to calling `input (JsonValue ...)`

output :: ToBytes a => a -> IO () Source #

Set plugin output

outputJSON :: JSON a => a -> IO () Source #

Set plugin output to a JSON encoded version of the provided value

getVar :: FromBytes a => String -> IO (Maybe a) Source #

Get a variable from the Extism runtime

setVar :: ToBytes a => String -> Maybe a -> IO () Source #

Set a variable

getConfig :: String -> IO (Maybe String) Source #

Get a configuration value

setError :: String -> IO () Source #

Set the current error message

class ToBytes a where Source #

A class used to convert values to bytes to be written into linear memory

Methods

toBytes :: a -> ByteString Source #

Instances

Instances details
ToBytes Int32 Source # 
Instance details

Defined in Extism.PDK.Memory

ToBytes Int64 Source # 
Instance details

Defined in Extism.PDK.Memory

ToBytes Word32 Source # 
Instance details

Defined in Extism.PDK.Memory

ToBytes Word64 Source # 
Instance details

Defined in Extism.PDK.Memory

ToBytes ByteString Source # 
Instance details

Defined in Extism.PDK.Memory

ToBytes String Source # 
Instance details

Defined in Extism.PDK.Memory

ToBytes Double Source # 
Instance details

Defined in Extism.PDK.Memory

ToBytes Float Source # 
Instance details

Defined in Extism.PDK.Memory

JSON a => ToBytes (JSONValue a) Source # 
Instance details

Defined in Extism.PDK.Memory

MsgPack a => ToBytes (MsgPackValue a) Source # 
Instance details

Defined in Extism.PDK.Memory

class FromBytes a where Source #

A class used to convert values from bytes read from linear memory

Instances

Instances details
FromBytes Int32 Source # 
Instance details

Defined in Extism.PDK.Memory

FromBytes Int64 Source # 
Instance details

Defined in Extism.PDK.Memory

FromBytes Word32 Source # 
Instance details

Defined in Extism.PDK.Memory

FromBytes Word64 Source # 
Instance details

Defined in Extism.PDK.Memory

FromBytes ByteString Source # 
Instance details

Defined in Extism.PDK.Memory

FromBytes String Source # 
Instance details

Defined in Extism.PDK.Memory

FromBytes Double Source # 
Instance details

Defined in Extism.PDK.Memory

FromBytes Float Source # 
Instance details

Defined in Extism.PDK.Memory

JSON a => FromBytes (JSONValue a) Source # 
Instance details

Defined in Extism.PDK.Memory

MsgPack a => FromBytes (MsgPackValue a) Source # 
Instance details

Defined in Extism.PDK.Memory

newtype JSONValue a Source #

A wrapper type for JSON encoded values

Constructors

JSONValue a 

Instances

Instances details
JSON a => FromBytes (JSONValue a) Source # 
Instance details

Defined in Extism.PDK.Memory

JSON a => ToBytes (JSONValue a) Source # 
Instance details

Defined in Extism.PDK.Memory

newtype MsgPackValue a Source #

A wrapper type for MsgPack encoded values

Constructors

MsgPackValue a 

Instances

Instances details
MsgPack a => FromBytes (MsgPackValue a) Source # 
Instance details

Defined in Extism.PDK.Memory

MsgPack a => ToBytes (MsgPackValue a) Source # 
Instance details

Defined in Extism.PDK.Memory