X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=GHC%2FStable.lhs;h=e96bf687ae909bf1dbf0071581edcf72cfb7e786;hb=be2750a0a11b919fb03cc070074e430f88bdfa90;hp=13194f515a3bdc711e6b7825359546821d00656f;hpb=d9a0d6f44a930da4ae49678908e37793d693467c;p=ghc-base.git diff --git a/GHC/Stable.lhs b/GHC/Stable.lhs index 13194f5..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 @@ -16,17 +22,17 @@ -- #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 @@ -71,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 @@ -100,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}