[commit: base] master: Export constructors for Foreign.C.Types and System.Posix.Types newtypes (182c4a7)
Ian Lynagh
igloo at earth.li
Fri Oct 21 03:14:43 CEST 2011
Repository : ssh://darcs.haskell.org//srv/darcs/packages/base
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/182c4a7ef123f7aba8efff5e49423be8b83fa414
>---------------------------------------------------------------
commit 182c4a7ef123f7aba8efff5e49423be8b83fa414
Author: Ian Lynagh <igloo at earth.li>
Date: Fri Oct 21 00:49:09 2011 +0100
Export constructors for Foreign.C.Types and System.Posix.Types newtypes
Part of trac #5529. We also now import the constructors in various
modules that use them in FFI decls.
>---------------------------------------------------------------
Control/Concurrent.hs | 2 +-
Foreign/C/Types.hs | 31 +++++++++----------------------
Foreign/Marshal/Alloc.hs | 2 +-
Foreign/Marshal/Utils.hs | 2 +-
GHC/Event/Array.hs | 2 +-
GHC/Event/Clock.hsc | 2 +-
GHC/Event/Control.hs | 2 +-
GHC/Event/EPoll.hsc | 2 +-
GHC/Event/Poll.hsc | 2 +-
GHC/Unicode.hs | 2 +-
System/Posix/Types.hs | 26 +++++++++++++-------------
11 files changed, 31 insertions(+), 44 deletions(-)
diff --git a/Control/Concurrent.hs b/Control/Concurrent.hs
index 077ed65..8f35069 100644
--- a/Control/Concurrent.hs
+++ b/Control/Concurrent.hs
@@ -124,7 +124,7 @@ import GHC.Base
import System.Posix.Types ( Fd )
import Foreign.StablePtr
-import Foreign.C.Types ( CInt )
+import Foreign.C.Types
import Control.Monad ( when )
#ifdef mingw32_HOST_OS
diff --git a/Foreign/C/Types.hs b/Foreign/C/Types.hs
index ed4c5e1..fb53b52 100644
--- a/Foreign/C/Types.hs
+++ b/Foreign/C/Types.hs
@@ -27,7 +27,6 @@
module Foreign.C.Types
( -- * Representations of C types
-#ifndef __NHC__
-- $ctypes
-- ** Integral types
@@ -37,20 +36,19 @@ module Foreign.C.Types
-- 'Prelude.Show', 'Prelude.Enum', 'Typeable', 'Storable',
-- 'Prelude.Bounded', 'Prelude.Real', 'Prelude.Integral' and
-- 'Bits'.
- CChar, CSChar, CUChar
- , CShort, CUShort, CInt, CUInt
- , CLong, CULong
- , CPtrdiff, CSize, CWchar, CSigAtomic
- , CLLong, CULLong
- , CIntPtr, CUIntPtr
- , CIntMax, CUIntMax
+ CChar(..), CSChar(..), CUChar(..)
+ , CShort(..), CUShort(..), CInt(..), CUInt(..)
+ , CLong(..), CULong(..)
+ , CPtrdiff(..), CSize(..), CWchar(..), CSigAtomic(..)
+ , CLLong(..), CULLong(..)
+ , CIntPtr(..), CUIntPtr(..), CIntMax(..), CUIntMax(..)
-- ** Numeric types
-- | These types are are represented as @newtype at s of basic
-- foreign types, and are instances of
-- 'Prelude.Eq', 'Prelude.Ord', 'Prelude.Num', 'Prelude.Read',
-- 'Prelude.Show', 'Prelude.Enum', 'Typeable' and 'Storable'.
- , CClock, CTime, CUSeconds, CSUSeconds
+ , CClock(..), CTime(..), CUSeconds(..), CSUSeconds(..)
-- extracted from CTime, because we don't want this comment in
-- the Haskell 2010 report:
@@ -67,21 +65,10 @@ module Foreign.C.Types
-- 'Prelude.Show', 'Prelude.Enum', 'Typeable', 'Storable',
-- 'Prelude.Real', 'Prelude.Fractional', 'Prelude.Floating',
-- 'Prelude.RealFrac' and 'Prelude.RealFloat'.
- , CFloat, CDouble
+ , CFloat(..), CDouble(..)
-- GHC doesn't support CLDouble yet
#ifndef __GLASGOW_HASKELL__
- , CLDouble
-#endif
-#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(..), CUSeconds(..), CSUSeconds(..)
- , CFloat(..), CDouble(..), CLDouble(..)
- , CIntPtr(..), CUIntPtr(..), CIntMax(..), CUIntMax(..)
+ , CLDouble(..)
#endif
-- ** Other types
diff --git a/Foreign/Marshal/Alloc.hs b/Foreign/Marshal/Alloc.hs
index 74db164..e404580 100644
--- a/Foreign/Marshal/Alloc.hs
+++ b/Foreign/Marshal/Alloc.hs
@@ -62,7 +62,7 @@ module Foreign.Marshal.Alloc (
) where
import Data.Maybe
-import Foreign.C.Types ( CSize )
+import Foreign.C.Types ( CSize(..) )
import Foreign.Storable ( Storable(sizeOf,alignment) )
#ifndef __GLASGOW_HASKELL__
diff --git a/Foreign/Marshal/Utils.hs b/Foreign/Marshal/Utils.hs
index ba8afcc..7fec1bf 100644
--- a/Foreign/Marshal/Utils.hs
+++ b/Foreign/Marshal/Utils.hs
@@ -51,7 +51,7 @@ module Foreign.Marshal.Utils (
import Data.Maybe
import Foreign.Ptr ( Ptr, nullPtr )
import Foreign.Storable ( Storable(poke) )
-import Foreign.C.Types ( CSize )
+import Foreign.C.Types ( CSize(..) )
import Foreign.Marshal.Alloc ( malloc, alloca )
#ifdef __GLASGOW_HASKELL__
diff --git a/GHC/Event/Array.hs b/GHC/Event/Array.hs
index 464bbf4..011580c 100644
--- a/GHC/Event/Array.hs
+++ b/GHC/Event/Array.hs
@@ -27,7 +27,7 @@ import Control.Monad hiding (forM_)
import Data.Bits ((.|.), shiftR)
import Data.IORef (IORef, atomicModifyIORef, newIORef, readIORef, writeIORef)
import Data.Maybe
-import Foreign.C.Types (CSize)
+import Foreign.C.Types (CSize(..))
import Foreign.ForeignPtr (ForeignPtr, withForeignPtr)
import Foreign.Ptr (Ptr, nullPtr, plusPtr)
import Foreign.Storable (Storable(..))
diff --git a/GHC/Event/Clock.hsc b/GHC/Event/Clock.hsc
index 998794b..98cda23 100644
--- a/GHC/Event/Clock.hsc
+++ b/GHC/Event/Clock.hsc
@@ -6,7 +6,7 @@ module GHC.Event.Clock (getCurrentTime) where
import Foreign (Ptr, Storable(..), nullPtr, with)
import Foreign.C.Error (throwErrnoIfMinus1_)
-import Foreign.C.Types (CInt, CLong, CTime, CSUSeconds)
+import Foreign.C.Types
import GHC.Base
import GHC.Err
import GHC.Num
diff --git a/GHC/Event/Control.hs b/GHC/Event/Control.hs
index bd58ae2..b05ac35 100644
--- a/GHC/Event/Control.hs
+++ b/GHC/Event/Control.hs
@@ -35,7 +35,7 @@ import GHC.Real (fromIntegral)
import GHC.Show (Show)
import GHC.Word (Word8)
import Foreign.C.Error (throwErrnoIfMinus1_)
-import Foreign.C.Types (CInt, CSize)
+import Foreign.C.Types (CInt(..), CSize(..))
import Foreign.ForeignPtr (mallocForeignPtrBytes, withForeignPtr)
import Foreign.Marshal (alloca, allocaBytes)
import Foreign.Marshal.Array (allocaArray)
diff --git a/GHC/Event/EPoll.hsc b/GHC/Event/EPoll.hsc
index 1cfd202..3a7e11b 100644
--- a/GHC/Event/EPoll.hsc
+++ b/GHC/Event/EPoll.hsc
@@ -41,7 +41,7 @@ import Data.Bits (Bits, (.|.), (.&.))
import Data.Monoid (Monoid(..))
import Data.Word (Word32)
import Foreign.C.Error (throwErrnoIfMinus1, throwErrnoIfMinus1_)
-import Foreign.C.Types (CInt)
+import Foreign.C.Types (CInt(..))
import Foreign.Marshal.Utils (with)
import Foreign.Ptr (Ptr)
import Foreign.Storable (Storable(..))
diff --git a/GHC/Event/Poll.hsc b/GHC/Event/Poll.hsc
index e34b47e..ce6a9de 100644
--- a/GHC/Event/Poll.hsc
+++ b/GHC/Event/Poll.hsc
@@ -30,7 +30,7 @@ import Control.Monad ((=<<), liftM, liftM2, unless)
import Data.Bits (Bits, (.|.), (.&.))
import Data.Maybe (Maybe(..))
import Data.Monoid (Monoid(..))
-import Foreign.C.Types (CInt, CShort, CULong)
+import Foreign.C.Types (CInt(..), CShort(..), CULong(..))
import Foreign.Ptr (Ptr)
import Foreign.Storable (Storable(..))
import GHC.Base
diff --git a/GHC/Unicode.hs b/GHC/Unicode.hs
index a55c8a0..bd2ed73 100644
--- a/GHC/Unicode.hs
+++ b/GHC/Unicode.hs
@@ -32,7 +32,7 @@ module GHC.Unicode (
import GHC.Base
import GHC.Real (fromIntegral)
-import Foreign.C.Types (CInt)
+import Foreign.C.Types (CInt(..))
#include "HsBaseConfig.h"
diff --git a/System/Posix/Types.hs b/System/Posix/Types.hs
index c8c0c48..c599c84 100644
--- a/System/Posix/Types.hs
+++ b/System/Posix/Types.hs
@@ -47,44 +47,44 @@ module System.Posix.Types (
-- * POSIX data types
#if defined(HTYPE_DEV_T)
- CDev,
+ CDev(..),
#endif
#if defined(HTYPE_INO_T)
- CIno,
+ CIno(..),
#endif
#if defined(HTYPE_MODE_T)
- CMode,
+ CMode(..),
#endif
#if defined(HTYPE_OFF_T)
- COff,
+ COff(..),
#endif
#if defined(HTYPE_PID_T)
- CPid,
+ CPid(..),
#endif
#if defined(HTYPE_SSIZE_T)
- CSsize,
+ CSsize(..),
#endif
#if defined(HTYPE_GID_T)
- CGid,
+ CGid(..),
#endif
#if defined(HTYPE_NLINK_T)
- CNlink,
+ CNlink(..),
#endif
#if defined(HTYPE_UID_T)
- CUid,
+ CUid(..),
#endif
#if defined(HTYPE_CC_T)
- CCc,
+ CCc(..),
#endif
#if defined(HTYPE_SPEED_T)
- CSpeed,
+ CSpeed(..),
#endif
#if defined(HTYPE_TCFLAG_T)
- CTcflag,
+ CTcflag(..),
#endif
#if defined(HTYPE_RLIM_T)
- CRLim,
+ CRLim(..),
#endif
Fd(..),
More information about the Cvs-libraries
mailing list