mirror of
https://github.com/extism/extism.git
synced 2026-04-23 03:00:11 -04:00
- Switches from `stack` to `cabal` - Cleanup SDK code - Adds release action (still waiting on Hackage upload approval) Co-authored-by: Steve Manuel <steve@dylib.so>
17 lines
457 B
Haskell
17 lines
457 B
Haskell
module Main where
|
|
|
|
import Extism
|
|
import Extism.Manifest(manifest, wasmFile)
|
|
|
|
unwrap (Right x) = x
|
|
unwrap (Left (ExtismError msg)) = do
|
|
error msg
|
|
|
|
main = do
|
|
let m = manifest [wasmFile "../wasm/code.wasm"]
|
|
context <- Extism.newContext
|
|
plugin <- unwrap <$> Extism.pluginFromManifest context m False
|
|
res <- unwrap <$> Extism.call plugin "count_vowels" (Extism.toByteString "this is a test")
|
|
putStrLn (Extism.fromByteString res)
|
|
Extism.free plugin
|