quickjs-hs: Wrapper for the QuickJS Javascript Engine

[ javascript, library, mit ] [ Propose Tags ] [ Report a vulnerability ]
This version is deprecated.

This library is a wrapper for the QuickJS Javascript Engine.

To get started, see the ReadMe below.


[Skip to Readme]

Modules

[Last Documentation]

  • Quickjs
    • Quickjs.Error
    • Quickjs.Types

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1, 0.1.1, 0.1.2, 0.1.2.1, 0.1.2.2, 0.1.2.3, 0.1.2.4 (info)
Change log ChangeLog.md
Dependencies aeson (>=1.4.7.1 && <1.5), base (>=4.7 && <5), bytestring (>=0.10.10.0 && <0.11), containers (>=0.6.2.1 && <0.7), exceptions (>=0.10.4 && <0.11), inline-c (>=0.6.0 && <0.10), mtl (>=2.2.2 && <2.3), scientific (>=0.3.6.2 && <0.4), string-conv (>=0.1.2 && <0.2), text (>=1.2.0 && <1.3), time (>=1.9.3 && <1.10), transformers (>=0.5.6.2 && <0.6), unliftio-core (>=0.1.2.0 && <0.2.1), unordered-containers (>=0.2.10.0 && <0.3), vector (>=0.12.1.2 && <0.13) [details]
License MIT
Copyright 2020 Sam Balco
Author Sam Balco
Maintainer goodlyrottenapple@gmail.com
Revised Revision 1 made by goodlyrottenapple at 2020-08-27T10:37:21Z
Category Javascript
Home page https://github.com/goodlyrottenapple/quickjs-hs#readme
Bug tracker https://github.com/goodlyrottenapple/quickjs-hs/issues
Source repo head: git clone https://github.com/goodlyrottenapple/quickjs-hs
Uploaded by goodlyrottenapple at 2020-08-27T10:30:27Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 1100 total (20 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2020-08-27 [all 2 reports]

Readme for quickjs-hs-0.1.1

[back to package description]

quickjs-hs

Tests CI

This package provides a Haskell wrapper for the QuickJS Javascript Engine.

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 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

Contributing

Please feel free to report bugs/submit feature requests via the github issue tracker and submit any pull requests to the git repository