[Git][ghc/ghc][master] JS: fix callback documentation (#24377)
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Wed Aug 7 15:54:17 UTC 2024
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
610840eb by Sylvain Henry at 2024-08-07T11:53:50-04:00
JS: fix callback documentation (#24377)
Fix #24377
- - - - -
2 changed files:
- docs/users_guide/javascript.rst
- libraries/ghc-internal/src/GHC/Internal/JS/Foreign/Callback.hs
Changes:
=====================================
docs/users_guide/javascript.rst
=====================================
@@ -127,17 +127,17 @@ objects or arrays as required.
There are three categories of functions that create callbacks, with the
arity-1 type signatures shown here for demonstration:
-* ``syncCallback1 :: (JSVal -> IO ()) -> OnBlocked -> IO (Callback (JSVal -> IO ()))``:
+* ``syncCallback1 :: OnBlocked -> (JSVal -> IO ()) -> IO (Callback (JSVal -> IO ()))``:
Synchronous callbacks that don't return a value. These take an additional
``data OnBlocked = ThrowWouldBlock | ContinueAsync`` argument for use in the
case that the thread becomes blocked on e.g. an ``MVar`` transaction.
-* ``syncCallback' :: (JSVal -> IO JSVal) -> IO (Callback (JSVal -> IO ()))``:
+* ``syncCallback1' :: (JSVal -> IO JSVal) -> IO (Callback (JSVal -> IO JSVal))``:
Synchronous callbacks that return a value. Because of the return value, there
is no possibility of continuing asynchronously, so no ``OnBlocked`` argument
is taken.
-* ``asyncCallback :: (JSVal -> IO ()) -> IO (Callback (JSVal -> IO ()))``:
+* ``asyncCallback1 :: (JSVal -> IO ()) -> IO (Callback (JSVal -> IO ()))``:
Asynchronous callbacks that immediately start in a new thread. Cannot return a
value.
=====================================
libraries/ghc-internal/src/GHC/Internal/JS/Foreign/Callback.hs
=====================================
@@ -117,7 +117,7 @@ asyncCallback :: IO () -- ^ the action that the callback runs
asyncCallback x = js_asyncCallback (unsafeCoerce x)
asyncCallback1 :: (JSVal -> IO ()) -- ^ the function that the callback calls
- -> IO (Callback (JSVal -> IO ())) -- ^ the calback
+ -> IO (Callback (JSVal -> IO ())) -- ^ the callback
asyncCallback1 x = js_asyncCallbackApply 1 (unsafeCoerce x)
asyncCallback2 :: (JSVal -> JSVal -> IO ()) -- ^ the Haskell function that the callback calls
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/610840eb5bf6bd59417b82cc61e74aeaacbe5462
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/610840eb5bf6bd59417b82cc61e74aeaacbe5462
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/20240807/fde0d025/attachment-0001.html>
More information about the ghc-commits
mailing list