@hackage mquickjs-hs0.1.2.4
Wrapper for the Micro QuickJS JavaScript Engine
Categories
License
MIT
Maintainer
haskell@ad-si.com
Links
Versions
- 0.1.2.4 Wed, 14 Jan 2026
Installation
Dependencies (15)
- aeson >=2.0 && <2.3
- base >=4.11 && <5
- bytestring >=0.10 && <0.13
- containers >=0.5 && <0.8
- exceptions >=0.8 && <0.11
- inline-c >=0.5 && <0.10 Show all…
Dependents (0)
mquickjs-hs
This package provides a Haskell wrapper for the Micro QuickJS JavaScript Engine. It has been inspired by the quickjs-rs and ocaml-quickjs libraries.
Features
The functionality is quite basic and is currently limited to:
- Evaluating JS code
- Calling a JS function in the global scope
- Marshalling Aeson Values to and from JSValues.
Examples
Evaluate an expression:
import MQuickJS
one_plus_two = mquickjs $ do
res <- eval "1+2"
liftIO $ print res
Declare a function and call it on an argument:
call_f = mquickjs $ do
_ <- eval_ "function f(x) { return x + 1; }"
res <- eval "f(2)"
liftIO $ print res
Pass a Haskell value (which has a ToJSON instance) to the JS runtime:
aeson_marshall = mquickjs $ do
_ <- eval_ "function f(x) { return x + 1; }"
res <- withJSValue (3::Int) $ \x -> call "f" [x]
liftIO $ print res
Contributing
Please feel free to report bugs/submit feature requests via the github issue tracker and submit any pull requests to the git repository.