ghcjs-base-stub-0.3.0.1: Allow GHCJS projects to compile under GHC and develop using intero.

Safe HaskellNone
LanguageHaskell2010

GHCJS.Foreign.Export

Description

Dynamically export Haskell values to JavaScript

Synopsis

Documentation

data Export a Source #

Instances
IsJSVal (Export a) Source # 
Instance details

Defined in GHCJS.Foreign.Export

Methods

jsval_ :: Export a -> JSVal

export :: Typeable a => a -> IO (Export a) Source #

Export any Haskell value to a JavaScript reference without evaluating it. The JavaScript reference can be passed to foreign code and used to retrieve the value later.

The data referenced by the value will be kept in memory until you call releaseExport, even if no foreign code references the export anymore.

withExport :: Typeable a => a -> (Export a -> IO b) -> IO b Source #

Export the value and run the action. The value is only exported for the duration of the action. Dereferencing it after the withExport call has returned will always return Nothing.

derefExport :: forall a. Typeable a => Export a -> IO (Maybe a) Source #

Retrieve the Haskell value from an export. Returns Nothing if the type does not match or the export has already been released.

releaseExport :: Export a -> IO () Source #

Release all memory associated with the export. Subsequent calls to derefExport will return Nothing