Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC

Commits:

1 changed file:

Changes:

  • docs/users_guide/javascript.rst
    ... ... @@ -60,6 +60,21 @@ for the Haskell `Bool` type:
    60 60
       foreign import javascript "((x) => { return 5; })"
    
    61 61
         type_error :: Bool -> Bool
    
    62 62
     
    
    63
    +Interruptible calling convention
    
    64
    +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    
    65
    +
    
    66
    +A foreign import can be declared with the `interruptible` calling convention:
    
    67
    +
    
    68
    +.. code-block:: haskell
    
    69
    +
    
    70
    +  foreign import javascript interruptible "((i,cont) => { ...; return cont(17); })"
    
    71
    +    foo :: Int -> IO Int
    
    72
    +
    
    73
    +In this case the javascript function will be passed one additional argument in
    
    74
    +the final position (noted `cont` in the example): it is a continuation
    
    75
    +function that must be called from JavaScript to return a value from the foreign
    
    76
    +call and to resume the execution of the Haskell code.
    
    77
    +
    
    63 78
     JSVal
    
    64 79
     ^^^^^
    
    65 80