[Git][ghc/ghc][wip/js-exports] Apply suggestions

Josh Meredith (@JoshMeredith) gitlab at gitlab.haskell.org
Tue Mar 21 13:33:05 UTC 2023



Josh Meredith pushed to branch wip/js-exports at Glasgow Haskell Compiler / GHC


Commits:
312b7cf2 by Sylvain Henry at 2023-03-21T13:33:01+00:00
Apply suggestions
- - - - -


1 changed file:

- docs/users_guide/exts/ffi.rst


Changes:

=====================================
docs/users_guide/exts/ffi.rst
=====================================
@@ -1163,12 +1163,13 @@ JSVal
 ^^^^^
 
 The JavaScript backend has a concept of an untyped 'plain' JavaScript
-value, under the guise of the type ``JSVal``. While many Haskell data
-types are represented in JavaScript-incompatible ways under-the-hood,
-``JSVal`` is represented as a real JavaScript object.
+value, under the guise of the type ``JSVal``. Values having this type
+are mostly opaque to Haskell codes: you can think of `JSVal` as a data type whose
+data constructors aren't exposed. Its main use case is to pass opaque
+JavaScript values from one FFI call to another.
 
-The module ``GHC.JS.Prim`` from ``base`` contains functions for working
-with foreign ``JSVal`` objects. Currently, it can contains the following
+Nevertheless the module ``GHC.JS.Prim`` from ``base`` contains functions for
+working with foreign ``JSVal`` objects. Currently, it provides the following
 conversions:
 
 * ``Int`` <-> ``JSVal`` (``toJSInt``, ``fromJSInt``)
@@ -1201,9 +1202,9 @@ The following types are supported in this way:
 * ``Bool``
 * ``Char``
 
-As in the C FFI, types in the JavaScript FFI can't be type checked, so
-the following example would compile successfully - despite the type
-error:
+As in the C FFI, types in the JavaScript FFI can't be type checked against the foreign code, so
+the following example would compile successfully - despite `5` not being a valid JavaScript value
+for the Haskell `Bool` type:
 
 .. code-block:: haskell
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/312b7cf23c2c40ec3008f25c99d58ab430ae8bfa

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/312b7cf23c2c40ec3008f25c99d58ab430ae8bfa
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230321/f99b0526/attachment-0001.html>


More information about the ghc-commits mailing list