projects
/
ghc-base.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
For GHC, implement the Typeable.hs macros using standalone deriving
[ghc-base.git]
/
Foreign
/
Ptr.hs
diff --git
a/Foreign/Ptr.hs
b/Foreign/Ptr.hs
index
564bb1c
..
26dda5c
100644
(file)
--- 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
-----------------------------------------------------------------------------
-- |
-- Module : Foreign.Ptr
@@
-58,7
+67,7
@@
import GHC.Show
import GHC.Enum
import GHC.Word ( Word(..) )
import GHC.Enum
import GHC.Word ( Word(..) )
-import Data.Int
+-- import Data.Int
import Data.Word
#else
import Control.Monad ( liftM )
import Data.Word
#else
import Control.Monad ( liftM )
@@
-105,12
+114,14
@@
foreign import ccall unsafe "freeHaskellFunctionPtr"
# ifdef __GLASGOW_HASKELL__
-- | An unsigned integral type that can be losslessly converted to and from
# 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
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
INTEGRAL_TYPE(IntPtr,tyConIntPtr,"IntPtr",Int)
-- Word and Int are guaranteed pointer-sized in GHC