[project @ 2002-09-11 11:06:05 by simonpj]
[ghc-base.git] / Foreign / Ptr.hs
index 0544486..125759e 100644 (file)
@@ -3,31 +3,32 @@
 -- |
 -- Module      :  Foreign.Ptr
 -- Copyright   :  (c) The FFI task force 2001
--- License     :  BSD-style (see the file libraries/core/LICENSE)
+-- License     :  BSD-style (see the file libraries/base/LICENSE)
 -- 
 -- Maintainer  :  ffi@haskell.org
 -- Stability   :  provisional
 -- Portability :  portable
 --
--- Pointer types.
+-- The "Ptr" module provides typed pointers to foreign data.  It is part
+-- of the Foreign Function Interface (FFI) and will normally be
+-- imported via the "Foreign" module.
 --
 -----------------------------------------------------------------------------
 
 module Foreign.Ptr (
-    --------------------------------------------------------------------
-    -- Data pointers.
+
+    -- * Data pointers
     
-    Ptr(..),      -- data Ptr a
+    Ptr,      -- data Ptr a
     nullPtr,      -- :: Ptr a
     castPtr,      -- :: Ptr a -> Ptr b
     plusPtr,      -- :: Ptr a -> Int -> Ptr b
     alignPtr,     -- :: Ptr a -> Int -> Ptr a
     minusPtr,     -- :: Ptr a -> Ptr b -> Int
     
-    --------------------------------------------------------------------
-    -- Function pointers.
+    -- * Function pointers
     
-    FunPtr(..),      -- data FunPtr a
+    FunPtr,      -- data FunPtr a
     nullFunPtr,      -- :: FunPtr a
     castFunPtr,      -- :: FunPtr a -> FunPtr b
     castFunPtrToPtr, -- :: FunPtr a -> Ptr b
@@ -62,6 +63,9 @@ instance Show (Ptr a) where
        -- word2Integer :: Word# -> Integer (stolen from Word.lhs)
        word2Integer w = case word2Integer# w of
                        (# s, d #) -> J# s d
+
+instance Show (FunPtr a) where
+   showsPrec p = showsPrec p . castFunPtrToPtr
 #endif
 #endif