hs-duktape: Haskell bindings for a very compact embedded ECMAScript (JavaScript) engine.

[ library, mit, web ] [ Propose Tags ]

[Skip to Readme]
Versions [faq] 0.1.0, 0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.1.5, 1.0.0
Dependencies aeson, base (>=4.3.0.0 && <5), bytestring, text, transformers [details]
License MIT
Copyright 2015 Greg V <greg@unrelenting.technology>, 2013-2015 Duktape authors
Author Greg V
Maintainer greg@unrelenting.technology
Category Web
Home page https://github.com/myfreeweb/hs-duktape
Source repo head: git clone git://github.com/myfreeweb/hs-duktape.git
Uploaded by myfreeweb at 2015-08-24T21:45:59Z
Distributions NixOS:1.0.0
Downloads 3937 total (37 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2015-08-24 [all 1 reports]

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for hs-duktape-0.1.0

[back to package description]

hs-duktape Hackage Build Status MIT License

Haskell bindings for duktape, a very compact embedded ECMAScript (JavaScript) engine.

Usage

Here's a simple REPL example:

module Main where

import Scripting.Duktape
import Control.Monad (forever)
import Data.ByteString.Char8 (pack)
import System.IO (hFlush, stdout)

main :: IO ()
main = do
  dukm <- createDuktapeCtx
  case dukm of
    Nothing -> putStrLn "I can't even (start Duktape)"
    Just duk -> forever $ do
      putStr "duktape> "
      hFlush stdout
      retVal <- evalDuktape duk =<< return . pack =<< getLine
      case retVal of
        Left e -> putStrLn $ "Duktape error: " ++ e
        Right Nothing -> putStrLn "No result"
        Right (Just v) -> print v

Aeson's Value type is used for exchanging values between Haskell and ECMAScript.
lens-aeson is a good library for working with Value, um, values.

Development

Use stack to build.

$ stack build

$ stack test && rm tests.tix

Contributing

Please feel free to submit pull requests! Bugfixes and simple non-breaking improvements will be accepted without any questions :-)

By participating in this project you agree to follow the Contributor Code of Conduct.

The list of contributors is available on GitHub.

License

Licensed under the MIT license (see to the LICENSE file).
Haskell bindings: Copyright (c) 2015 Greg V greg@unrelenting.technology
Duktape: Copyright (c) 2013-2015 by Duktape authors (see duktape/AUTHORS.rst)