
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: fe6ed8d9 by Sylvain Henry at 2025-04-24T18:04:12-04:00 Doc: add doc for JS interruptible calling convention (#24444) - - - - - 1 changed file: - docs/users_guide/javascript.rst Changes: ===================================== docs/users_guide/javascript.rst ===================================== @@ -60,6 +60,21 @@ for the Haskell `Bool` type: foreign import javascript "((x) => { return 5; })" type_error :: Bool -> Bool +Interruptible calling convention +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +A foreign import can be declared with the `interruptible` calling convention: + +.. code-block:: haskell + + foreign import javascript interruptible "((i,cont) => { ...; return cont(17); })" + foo :: Int -> IO Int + +In this case the javascript function will be passed one additional argument in +the final position (noted `cont` in the example): it is a continuation +function that must be called from JavaScript to return a value from the foreign +call and to resume the execution of the Haskell code. + JSVal ^^^^^ View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/fe6ed8d91270c4acc4627f701707de80... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/fe6ed8d91270c4acc4627f701707de80... You're receiving this email because of your account on gitlab.haskell.org.