Skip to content

Commit

Permalink
docs: add some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
zshipko committed Sep 22, 2023
1 parent c27bcc8 commit d7d02a2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Extism.hs
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,11 @@ functionExists (Plugin plugin) name =
b <- withCString name (extism_plugin_function_exists plugin')
if b == 1 then return True else return False)

-- Used to convert a value into linear memory
class ToBytes a where
toBytes :: a -> B.ByteString

-- Used to read a value from linear memory
class FromPointer a where
fromPointer :: CString -> Int -> IO (Result a)

Expand All @@ -168,6 +170,7 @@ instance FromPointer [Char] where
Left e -> return $ Left e
Right bs -> return $ Right $ fromByteString bs

-- Wraps a `JSON` value for input/output
newtype JSONValue x = JSONValue x

instance Extism.JSON.JSON a => ToBytes (JSONValue a) where
Expand Down

0 comments on commit d7d02a2

Please sign in to comment.