quickjs-hs alternatives and similar packages
Alternatively, view quickjs-hs alternatives based on common mentions on social networks and blogs.
Do you think we are missing an alternative of quickjs-hs or a related project?
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.
Evaluate an expression:
import Quickjs one_plus_two = quickjs $ do res <- eval "1+2" liftIO $ print res
Declare a function and call it on an argument:
call_f = quickjs $ do _ <- eval_ "f = (x) => x+1" res <- eval "f(2)" liftIO $ print res
Pass a Haskell value (which has a ToJSON instance) to the JS runtime:
aeson_marshall = quickjs $ do _ <- eval_ "f = (x) => x+1" res <- withJSValue (3::Int) $ \x -> call "f" [x] liftIO $ print res