File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -30,8 +30,10 @@ import Unsafe.Coerce
3030import qualified GHC.Exts as Exts
3131
3232import GHCJS.Prim
33+ import GHCJS.Types
3334
34- type Export a = JSVal
35+ newtype Export a = Export JSVal
36+ instance IsJSVal (Export a )
3537
3638{- |
3739 Export any Haskell value to a JavaScript reference without evaluating it.
@@ -66,7 +68,7 @@ derefExport e = do
6668 r <- js_derefExport w1 w2 e
6769 if isNull r
6870 then return Nothing
69- else unsafeCoerce ( js_toHeapObject r)
71+ else unsafeCoerce <$> js_toHeapObject r
7072
7173{- |
7274 Release all memory associated with the export. Subsequent calls to
@@ -82,10 +84,10 @@ foreign import javascript unsafe
8284 js_export :: Word64 -> Word64 -> Any -> IO (Export a )
8385foreign import javascript unsafe
8486 " h$derefExport"
85- js_derefExport :: Word64 -> Word64 -> JSVal -> IO JSVal
87+ js_derefExport :: Word64 -> Word64 -> Export a -> IO JSVal
8688foreign import javascript unsafe
87- " $r = $1;" js_toHeapObject :: JSVal -> Exts. Any
89+ " $r = $1;" js_toHeapObject :: JSVal -> IO Exts. Any
8890
8991foreign import javascript unsafe
9092 " h$releaseExport"
91- js_releaseExport :: JSVal -> IO ()
93+ js_releaseExport :: Export a -> IO ()
You can’t perform that action at this time.
0 commit comments