HORIZON HASKELLDocslts/ghc-10.0.x04404a62026-10-19Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 04404a6 · 2026-10-19

  • Packagebase-4.23.0.0
  • Exports15
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceCallback.hs
valuereleaseCallback :: Callback a -> IO ()

When you create a callback, the Haskell runtime stores a reference to the exported IO action or function. This means that all data referenced by the exported value stays in memory, even if nothing outside the Haskell runtime holds a reference to to callback. Use releaseCallback to free the reference. Subsequent calls from JavaScript to the callback will result in an exception.

asynchronous callbacks

valueasyncCallback
  1. :: IO ()

    the action that the callback runs

  2. -> IO (Callback (IO ()))

    the callback

Make a callback (JavaScript function) that runs the supplied IO action in an asynchronous thread when called. Call releaseCallback when done with the callback, freeing data referenced by the IO action.

synchronous callbacks

valuesyncCallback
  1. :: OnBlocked

    what to do when the thread blocks

  2. -> IO ()

    the Haskell action

  3. -> IO (Callback (IO ()))

    the callback

Make a callback (JavaScript function) that runs the supplied IO action in a synchronous thread when called. Call releaseCallback when done with the callback, freeing memory referenced by the IO action.

valuesyncCallback1
  1. :: OnBlocked

    what to do when the thread blocks

  2. -> (JSVal -> IO ())

    the Haskell function

  3. -> IO (Callback (JSVal -> IO ()))

    the callback

Make a callback (JavaScript function) that runs the supplied IO function in a synchronous thread when called. The callback takes one argument that it passes as a JSVal value to the Haskell function. Call releaseCallback when done with the callback, freeing data referenced by the function.

valuesyncCallback2
  1. :: OnBlocked

    what to do when the thread blocks

  2. -> (JSVal -> JSVal -> IO ())

    the Haskell function

  3. -> IO (Callback (JSVal -> JSVal -> IO ()))

    the callback

Make a callback (JavaScript function) that runs the supplied IO function in a synchronous thread when called. The callback takes two arguments that it passes as JSVal values to the Haskell function. Call releaseCallback when done with the callback, freeing data referenced by the function.

valuesyncCallback3
  1. :: OnBlocked

    what to do when the thread blocks

  2. -> (JSVal -> JSVal -> JSVal -> IO ())

    the Haskell function

  3. -> IO (Callback (JSVal -> JSVal -> JSVal -> IO ()))

    the callback

Make a callback (JavaScript function) that runs the supplied IO function in a synchronous thread when called. The callback takes three arguments that it passes as JSVal values to the Haskell function. Call releaseCallback when done with the callback, freeing data referenced by the function.

synchronous callbacks that return a value