X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=GHC%2FStable.lhs;h=e96bf687ae909bf1dbf0071581edcf72cfb7e786;hb=HEAD;hp=b52e756053914a677f6a15eac102a0331a7b2bfd;hpb=aaf764b3ad8b1816d68b5f27299eac125f08e1a5;p=ghc-base.git diff --git a/GHC/Stable.lhs b/GHC/Stable.lhs index b52e756..e96bf68 100644 --- a/GHC/Stable.lhs +++ b/GHC/Stable.lhs @@ -1,5 +1,11 @@ \begin{code} -{-# OPTIONS_GHC -fno-implicit-prelude #-} +{-# LANGUAGE NoImplicitPrelude + , MagicHash + , UnboxedTuples + , ForeignFunctionInterface + #-} +{-# OPTIONS_HADDOCK hide #-} + ----------------------------------------------------------------------------- -- | -- Module : GHC.Stable @@ -14,18 +20,19 @@ -- ----------------------------------------------------------------------------- +-- #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 @@ -70,7 +77,7 @@ deRefStablePtr (StablePtr sp) = IO $ \s -> deRefStablePtr# sp s -- 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 @@ -99,7 +106,7 @@ castPtrToStablePtr (Ptr a) = StablePtr (unsafeCoerce# a) 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}