| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Language.JavaScript.Inline
Synopsis
- module Language.JavaScript.Inline.Core
- newtype Aeson a = Aeson {
- unAeson :: a
- js :: QuasiQuoter
Core functionalities
aeson support
If a Haskell type a has ToJSON and FromJSON instances, then we
can derive ToJS and FromJS instances for it using:
deriving (ToJS, FromJS) via (Aeson a), using theDerivingViaextensionderiving (ToJS, FromJS), using theGeneralizedNewtypeDerivingextension
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.