summaryrefslogtreecommitdiff
path: root/docs/users_guide/javascript.rst
diff options
context:
space:
mode:
authorKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>2023-04-20 16:18:15 +0200
committerKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>2023-04-20 16:35:04 +0200
commit83664b5aca556ad0433183958fee6b640fc5eb48 (patch)
tree41963ec0283164f364970e0d4b7d14a6157d24e3 /docs/users_guide/javascript.rst
parentab6c1d295cd9f492838dbd481ecc2a66bbd17393 (diff)
downloadhaskell-wip/minor-docs.tar.gz
Minor doc fixeswip/minor-docs
- Add docs/index.html to .gitignore. It is created by ./hadrian/build docs, and it was the only file in Hadrian's templateRules not present in .gitignore. - Mention that MultiWayIf supports non-boolean guards - Remove documentation of optdll - removed in 2007, 763daed95 - Fix markdown syntax
Diffstat (limited to 'docs/users_guide/javascript.rst')
-rw-r--r--docs/users_guide/javascript.rst10
1 files changed, 5 insertions, 5 deletions
diff --git a/docs/users_guide/javascript.rst b/docs/users_guide/javascript.rst
index f33c146f87..3926802d3a 100644
--- a/docs/users_guide/javascript.rst
+++ b/docs/users_guide/javascript.rst
@@ -1,4 +1,4 @@
-.. _ffi-javascript
+.. _ffi-javascript:
FFI and the JavaScript Backend
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -23,7 +23,7 @@ look like:
js_add :: Int -> Int -> Int
JSVal
-^^^^^
+~~~~~
The JavaScript backend has a concept of an untyped 'plain' JavaScript
value, under the guise of the type ``JSVal``. Values having this type
@@ -47,7 +47,7 @@ It also contains functions for working with objects:
* ``getProp :: JSVal -> String -> JSVal`` - object field access
JavaScript FFI Types
-^^^^^^^^^^^^^^^^^^^^
+~~~~~~~~~~~~~~~~~~~~
Some types are able to be used directly in the type signatures of foreign
exports, without conversion to a ``JSVal``. We saw in the first example
@@ -75,7 +75,7 @@ for the Haskell `Bool` type:
type_error :: Bool -> Bool
JavaScript Callbacks
-^^^^^^^^^^^^^^^^^^^^
+~~~~~~~~~~~~~~~~~~~~
The JavaScript execution model is based around callback functions, and
GHC's JavaScript backend implements these as a type in order to support
@@ -146,7 +146,7 @@ passed as an ``Int`` to a ``Callback`` that accepts a ``JSVal``:
releaseCallback add3
Callbacks as Foreign Exports
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
JavaScript callbacks allow for a sort of FFI exports via FFI imports. To do
this, a global JavaScript variable is set, and that global variable can then