\begin{code}
-{-# OPTIONS_GHC -fno-implicit-prelude #-}
+{-# LANGUAGE NoImplicitPrelude
+ , MagicHash
+ , UnboxedTuples
+ , ForeignFunctionInterface
+ #-}
+{-# OPTIONS_HADDOCK hide #-}
+
-----------------------------------------------------------------------------
-- |
-- Module : GHC.Stable
--
-----------------------------------------------------------------------------
+-- #hide
module GHC.Stable
- ( StablePtr(..)
- , newStablePtr -- :: a -> IO (StablePtr a)
- , deRefStablePtr -- :: StablePtr a -> a
- , freeStablePtr -- :: StablePtr a -> IO ()
- , castStablePtrToPtr -- :: StablePtr a -> Ptr ()
- , castPtrToStablePtr -- :: Ptr () -> StablePtr a
+ ( StablePtr(..)
+ , newStablePtr -- :: a -> IO (StablePtr a)
+ , deRefStablePtr -- :: StablePtr a -> a
+ , freeStablePtr -- :: StablePtr a -> IO ()
+ , castStablePtrToPtr -- :: StablePtr a -> Ptr ()
+ , castPtrToStablePtr -- :: Ptr () -> StablePtr a
) where
import GHC.Ptr
import GHC.Base
-import GHC.IOBase
+-- import GHC.IO
-----------------------------------------------------------------------------
-- Stable Pointers
-- it may be 'Foreign.Ptr.nullPtr'). Nevertheless, the call
-- to 'castStablePtrToPtr' is guaranteed not to diverge.
--
-foreign import ccall unsafe freeStablePtr :: StablePtr a -> IO ()
+foreign import ccall unsafe "hs_free_stable_ptr" freeStablePtr :: StablePtr a -> IO ()
-- |
-- Coerce a stable pointer to an address. No guarantees are made about
instance Eq (StablePtr a) where
(StablePtr sp1) == (StablePtr sp2) =
- case eqStablePtr# sp1 sp2 of
- 0# -> False
- _ -> True
+ case eqStablePtr# sp1 sp2 of
+ 0# -> False
+ _ -> True
\end{code}