X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Foreign%2FPtr.hs;h=26dda5c23763fab24ae43e57b127a23b810da6ee;hb=f98950484a7cb01e43352e3d88277a2784cd58bf;hp=f57e1ac52d67da9ef45bef84fe5968690c11bdc0;hpb=10de2c656f74562b662c22928be85e1b3ccda796;p=ghc-base.git diff --git a/Foreign/Ptr.hs b/Foreign/Ptr.hs index f57e1ac..26dda5c 100644 --- a/Foreign/Ptr.hs +++ b/Foreign/Ptr.hs @@ -1,4 +1,13 @@ -{-# OPTIONS_GHC -XNoImplicitPrelude #-} +{-# LANGUAGE CPP + , NoImplicitPrelude + , ForeignFunctionInterface + , MagicHash + , GeneralizedNewtypeDeriving + #-} +#ifdef __GLASGOW_HASKELL__ +{-# LANGUAGE DeriveDataTypeable, StandaloneDeriving #-} +#endif + ----------------------------------------------------------------------------- -- | -- Module : Foreign.Ptr @@ -50,7 +59,6 @@ module Foreign.Ptr ( #ifdef __GLASGOW_HASKELL__ import GHC.Ptr -import GHC.IOBase import GHC.Base import GHC.Num import GHC.Read @@ -59,7 +67,7 @@ import GHC.Show import GHC.Enum import GHC.Word ( Word(..) ) -import Data.Int +-- import Data.Int import Data.Word #else import Control.Monad ( liftM ) @@ -67,7 +75,7 @@ import Foreign.C.Types #endif import Data.Bits -import Data.Typeable ( Typeable(..), mkTyCon, mkTyConApp ) +import Data.Typeable import Foreign.Storable ( Storable(..) ) #ifdef __NHC__ @@ -106,12 +114,14 @@ foreign import ccall unsafe "freeHaskellFunctionPtr" # ifdef __GLASGOW_HASKELL__ -- | An unsigned integral type that can be losslessly converted to and from --- @Ptr@. +-- @Ptr@. This type is also compatible with the C99 type @uintptr_t@, and +-- can be marshalled to and from that type safely. INTEGRAL_TYPE(WordPtr,tyConWordPtr,"WordPtr",Word) -- Word and Int are guaranteed pointer-sized in GHC -- | A signed integral type that can be losslessly converted to and from --- @Ptr@. +-- @Ptr@. This type is also compatible with the C99 type @intptr_t@, and +-- can be marshalled to and from that type safely. INTEGRAL_TYPE(IntPtr,tyConIntPtr,"IntPtr",Int) -- Word and Int are guaranteed pointer-sized in GHC