inline-js-0.0.1.0: Call JavaScript from Haskell.
Safe HaskellNone
LanguageHaskell2010

Language.JavaScript.Inline

Synopsis

Core functionalities

aeson support

newtype Aeson a Source #

If a Haskell type a has ToJSON and FromJSON instances, then we can derive ToJS and FromJS instances for it using:

  1. deriving (ToJS, FromJS) via (Aeson a), using the DerivingVia extension
  2. deriving (ToJS, FromJS), using the GeneralizedNewtypeDeriving extension

Constructors

Aeson 

Fields

Instances

Instances details
Show a => Show (Aeson a) Source # 
Instance details

Defined in Language.JavaScript.Inline.Aeson

Methods

showsPrec :: Int -> Aeson a -> ShowS #

show :: Aeson a -> String #

showList :: [Aeson a] -> ShowS #

ToJSON a => ToJS (Aeson a) Source # 
Instance details

Defined in Language.JavaScript.Inline.Aeson

Methods

toJS :: Aeson a -> JSExpr #

FromJSON a => FromJS (Aeson a) Source # 
Instance details

Defined in Language.JavaScript.Inline.Aeson

QuasiQuoters for inline JavaScript

js :: QuasiQuoter Source #

Generate a JSExpr from inline JavaScript code. The code should be a single expression or a code block with potentially multiple statements (use return to specify the result value in which case). Top-level await is supported.

Use $var to refer to a Haskell variable var. var should be an instance of ToJS.

Important: when using js, GHC calls the node process at compile-time in order to use a JavaScript-based JavaScript parser to extract necessary info. Don't forget to ensure node is available in PATH at compile-time.