Skip to content
Snippets Groups Projects
Commit fe6ed8d9 authored by Sylvain Henry's avatar Sylvain Henry Committed by Marge Bot
Browse files

Doc: add doc for JS interruptible calling convention (#24444)

parent 1bd3d13e
No related branches found
No related tags found
No related merge requests found
......@@ -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
^^^^^
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment