Skip to content

The callback argument passed to foreign import javascript interruptible functions is undocumented

Summary

Location of documentation issue: the GHC user's guide for FFI and the JavaScript Backend.

The JavaScript Backend will pass a callback function as extra last argument to the JavaScript function defined or referenced by a foreign import javascript interruptible string. Such argument does not appear in the Haskell type signature of the function.

For more details and context: https://github.com/ghcjs/ghcjs-dom/pull/104#issuecomment-1945867928

Proposed improvements or changes

The semantics of the foreign import javascript interruptible functions should be added the JavaScript Backend FFI documentation, together with a mention of the extra callback parameter and an example of how to use it in JavaScript code.

Environment

  • GHC version used (if appropriate): 9.8.1
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information