Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Extism plugin development kit, used with the wasm32-wasi-ghc backend to make Extism plugins
Synopsis
- data LogLevel
- log :: LogLevel -> String -> IO ()
- tryInput :: FromBytes a => IO (Either String a)
- inputByteString :: IO ByteString
- input :: forall a. FromBytes a => IO a
- inputString :: IO String
- inputJSON :: Data a => IO a
- output :: ToBytes a => a -> IO ()
- outputJSON :: Data a => a -> IO ()
- getVar :: FromBytes a => String -> IO (Maybe a)
- setVar :: ToBytes a => String -> Maybe a -> IO ()
- getConfig :: String -> IO (Maybe String)
- setError :: String -> IO ()
- logError :: String -> IO ()
- logInfo :: String -> IO ()
- logDebug :: String -> IO ()
- logWarn :: String -> IO ()
- class ToBytes a where
- toBytes :: a -> ByteString
- class FromBytes a where
- fromBytes :: ByteString -> Either String a
- newtype JSON a = JSON a
- newtype MsgPack a = MsgPack a
Documentation
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
inputString :: IO String Source #
Get plugin input as a String
inputJSON :: Data a => IO a Source #
Get input as JSON
, this is similar to calling `input (JsonValue ...)`
outputJSON :: Data a => a -> IO () Source #
Set plugin output to a JSON encoded version of the provided value
class ToBytes a where Source #
A class used to convert values to bytes to be written into linear memory
toBytes :: a -> ByteString Source #
Instances
ToBytes Int32 Source # | |
Defined in Extism.PDK.Memory toBytes :: Int32 -> ByteString Source # | |
ToBytes Int64 Source # | |
Defined in Extism.PDK.Memory toBytes :: Int64 -> ByteString Source # | |
ToBytes Word32 Source # | |
Defined in Extism.PDK.Memory toBytes :: Word32 -> ByteString Source # | |
ToBytes Word64 Source # | |
Defined in Extism.PDK.Memory toBytes :: Word64 -> ByteString Source # | |
ToBytes ByteString Source # | |
Defined in Extism.PDK.Memory toBytes :: ByteString -> ByteString Source # | |
ToBytes String Source # | |
Defined in Extism.PDK.Memory toBytes :: String -> ByteString Source # | |
ToBytes Double Source # | |
Defined in Extism.PDK.Memory toBytes :: Double -> ByteString Source # | |
ToBytes Float Source # | |
Defined in Extism.PDK.Memory toBytes :: Float -> ByteString Source # | |
Data a => ToBytes (JSON a) Source # | |
Defined in Extism.PDK.Memory toBytes :: JSON a -> ByteString Source # | |
MsgPack a => ToBytes (MsgPack a) Source # | |
Defined in Extism.PDK.Memory toBytes :: MsgPack a -> ByteString Source # |
class FromBytes a where Source #
A class used to convert values from bytes read from linear memory
Instances
FromBytes Int32 Source # | |
Defined in Extism.PDK.Memory | |
FromBytes Int64 Source # | |
Defined in Extism.PDK.Memory | |
FromBytes Word32 Source # | |
Defined in Extism.PDK.Memory | |
FromBytes Word64 Source # | |
Defined in Extism.PDK.Memory | |
FromBytes ByteString Source # | |
Defined in Extism.PDK.Memory fromBytes :: ByteString -> Either String ByteString Source # | |
FromBytes String Source # | |
Defined in Extism.PDK.Memory | |
FromBytes Double Source # | |
Defined in Extism.PDK.Memory | |
FromBytes Float Source # | |
Defined in Extism.PDK.Memory | |
Data a => FromBytes (JSON a) Source # | |
Defined in Extism.PDK.Memory | |
MsgPack a => FromBytes (MsgPack a) Source # | |
Defined in Extism.PDK.Memory |
A wrapper type for JSON encoded values
JSON a |
A wrapper type for MsgPack encoded values
MsgPack a |