[project @ 2003-07-24 12:19:57 by ralf]
[ghc-base.git] / Foreign / C / Types.hs
index 7fe89ee..d2f3bc8 100644 (file)
@@ -9,28 +9,37 @@
 -- Stability   :  provisional
 -- Portability :  portable
 --
--- Mapping of C types to corresponding Haskell types. A cool hack...
+-- Mapping of C types to corresponding Haskell types.
 --
 -----------------------------------------------------------------------------
 
 module Foreign.C.Types
+#ifndef __NHC__
        ( -- Integral types, instances of: Eq, Ord, Num, Read, Show, Enum,
          -- Typeable, Storable, Bounded, Real, Integral, Bits
-         CChar(..),  CSChar(..),  CUChar(..)
-       , CShort(..), CUShort(..), CInt(..),   CUInt(..)
-       , CLong(..),  CULong(..)
-       , CPtrdiff(..), CSize(..), CWchar(..), CSigAtomic(..)
-#ifndef __HUGS__
-        , CLLong(..), CULLong(..)
-#endif
+         CChar,  CSChar,  CUChar
+       , CShort, CUShort, CInt,   CUInt
+       , CLong,  CULong
+       , CPtrdiff, CSize, CWchar, CSigAtomic
+        , CLLong, CULLong
          -- Numeric types, instances of: Eq, Ord, Num, Read, Show, Enum,
          -- Typeable, Storable
-       , CClock(..),   CTime(..)
+       , CClock,   CTime
 
          -- Floating types, instances of: Eq, Ord, Num, Read, Show, Enum,
          -- Typeable, Storable, Real, Fractional, Floating, RealFrac,
          -- RealFloat 
-       , CFloat(..),  CDouble(..), CLDouble(..)
+       , CFloat,  CDouble, CLDouble
+#else
+       ( -- Exported non-abstractly in nhc98 to fix an interface file problem.
+         CChar(..),    CSChar(..),  CUChar(..)
+       , CShort(..),   CUShort(..), CInt(..),   CUInt(..)
+       , CLong(..),    CULong(..)
+       , CPtrdiff(..), CSize(..),   CWchar(..), CSigAtomic(..)
+        , CLLong(..),   CULLong(..)
+       , CClock(..),   CTime(..)
+       , CFloat(..),   CDouble(..), CLDouble(..)
+#endif
 
           -- Instances of: Eq and Storable
        , CFile,        CFpos,     CJmpBuf
@@ -38,13 +47,13 @@ module Foreign.C.Types
 
 #ifdef __NHC__
 import NHC.FFI
-  ( CChar(..),  CSChar(..),  CUChar(..)
-  , CShort(..), CUShort(..), CInt(..),   CUInt(..)
-  , CLong(..),  CULong(..), CLLong(..), CULLong(..)
-  , CPtrdiff(..), CSize(..), CWchar(..), CSigAtomic(..)
+  ( CChar(..),    CSChar(..),  CUChar(..)
+  , CShort(..),   CUShort(..), CInt(..),   CUInt(..)
+  , CLong(..),    CULong(..),  CLLong(..), CULLong(..)
+  , CPtrdiff(..), CSize(..),   CWchar(..), CSigAtomic(..)
   , CClock(..),   CTime(..)
-  , CFloat(..),  CDouble(..), CLDouble(..)
-  , CFile,        CFpos,     CJmpBuf
+  , CFloat(..),   CDouble(..), CLDouble(..)
+  , CFile,        CFpos,       CJmpBuf
   , Storable(..)
   )
 #else
@@ -54,9 +63,7 @@ import Foreign.Storable
 import Data.Bits       ( Bits(..) )
 import Data.Int                ( Int8,  Int16,  Int32,  Int64  )
 import Data.Word       ( Word8, Word16, Word32, Word64 )
-#ifndef __NHC__
 import Data.Dynamic
-#endif
 
 #ifdef __GLASGOW_HASKELL__
 import GHC.Base
@@ -71,7 +78,7 @@ import Control.Monad
 import Foreign.Ptr
 #endif
 
-#include "Dynamic.h"
+#include "Typeable.h"
 #include "CTypes.h"
 
 INTEGRAL_TYPE(CChar,tyConCChar,"CChar",HTYPE_CHAR)
@@ -87,10 +94,8 @@ INTEGRAL_TYPE(CUInt,tyConCUInt,"CUInt",HTYPE_UNSIGNED_INT)
 INTEGRAL_TYPE(CLong,tyConCLong,"CLong",HTYPE_LONG)
 INTEGRAL_TYPE(CULong,tyConCULong,"CULong",HTYPE_UNSIGNED_LONG)
 
-#ifndef __HUGS__
 INTEGRAL_TYPE(CLLong,tyConCLLong,"CLLong",HTYPE_LONG_LONG)
 INTEGRAL_TYPE(CULLong,tyConCULLong,"CULLong",HTYPE_UNSIGNED_LONG_LONG)
-#endif
 
 {-# RULES
 "fromIntegral/a->CChar"   fromIntegral = \x -> CChar   (fromIntegral x)