summaryrefslogtreecommitdiff
path: root/libraries/base/Foreign
diff options
context:
space:
mode:
authorSeraphime Kirkovski <kirkseraph@gmail.com>2016-06-06 12:29:38 +0200
committerBen Gamari <ben@smart-cactus.org>2016-06-06 15:07:18 +0200
commita90085bd45239fffd65c01c24752a9bbcef346f1 (patch)
tree41a85ba36720d8fba0a3296ea7a844dd9fc0042a /libraries/base/Foreign
parent48e9a1f5521fa3185510d144dd28a87e452ce134 (diff)
downloadhaskell-a90085bd45239fffd65c01c24752a9bbcef346f1.tar.gz
Add @since annotations to base instances
Add @since annotations to instances in `base`. Test Plan: * ./validate # some commets shouldn't break the build * review the annotations for absurdities. Reviewers: ekmett, goldfire, RyanGlScott, austin, hvr, bgamari Reviewed By: RyanGlScott, hvr, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2277 GHC Trac Issues: #11767
Diffstat (limited to 'libraries/base/Foreign')
-rw-r--r--libraries/base/Foreign/C/Error.hs1
-rw-r--r--libraries/base/Foreign/C/Types.hs1
-rw-r--r--libraries/base/Foreign/Storable.hs20
3 files changed, 22 insertions, 0 deletions
diff --git a/libraries/base/Foreign/C/Error.hs b/libraries/base/Foreign/C/Error.hs
index 761435183e..90b949b782 100644
--- a/libraries/base/Foreign/C/Error.hs
+++ b/libraries/base/Foreign/C/Error.hs
@@ -111,6 +111,7 @@ import GHC.Base
newtype Errno = Errno CInt
+-- | @since 2.01
instance Eq Errno where
errno1@(Errno no1) == errno2@(Errno no2)
| isValidErrno errno1 && isValidErrno errno2 = no1 == no2
diff --git a/libraries/base/Foreign/C/Types.hs b/libraries/base/Foreign/C/Types.hs
index b725a4a11b..a16f838eed 100644
--- a/libraries/base/Foreign/C/Types.hs
+++ b/libraries/base/Foreign/C/Types.hs
@@ -188,6 +188,7 @@ ARITHMETIC_TYPE(CTime,HTYPE_TIME_T)
-- | Haskell type representing the C @useconds_t@ type.
--
-- @since 4.4.0.0
+
ARITHMETIC_TYPE(CUSeconds,HTYPE_USECONDS_T)
-- | Haskell type representing the C @suseconds_t@ type.
--
diff --git a/libraries/base/Foreign/Storable.hs b/libraries/base/Foreign/Storable.hs
index 5b657a19e3..a58e0db069 100644
--- a/libraries/base/Foreign/Storable.hs
+++ b/libraries/base/Foreign/Storable.hs
@@ -145,6 +145,7 @@ class Storable a where
peek ptr = peekElemOff ptr 0
poke ptr = pokeElemOff ptr 0
+-- | @since 4.9.0.0
instance Storable () where
sizeOf _ = 0
alignment _ = 1
@@ -153,6 +154,7 @@ instance Storable () where
-- System-dependent, but rather obvious instances
+-- | @since 2.01
instance Storable Bool where
sizeOf _ = sizeOf (undefined::HTYPE_INT)
alignment _ = alignment (undefined::HTYPE_INT)
@@ -166,54 +168,71 @@ instance Storable (T) where { \
peekElemOff = read; \
pokeElemOff = write }
+-- | @since 2.01
STORABLE(Char,SIZEOF_INT32,ALIGNMENT_INT32,
readWideCharOffPtr,writeWideCharOffPtr)
+-- | @since 2.01
STORABLE(Int,SIZEOF_HSINT,ALIGNMENT_HSINT,
readIntOffPtr,writeIntOffPtr)
+-- | @since 2.01
STORABLE(Word,SIZEOF_HSWORD,ALIGNMENT_HSWORD,
readWordOffPtr,writeWordOffPtr)
+-- | @since 2.01
STORABLE((Ptr a),SIZEOF_HSPTR,ALIGNMENT_HSPTR,
readPtrOffPtr,writePtrOffPtr)
+-- | @since 2.01
STORABLE((FunPtr a),SIZEOF_HSFUNPTR,ALIGNMENT_HSFUNPTR,
readFunPtrOffPtr,writeFunPtrOffPtr)
+-- | @since 2.01
STORABLE((StablePtr a),SIZEOF_HSSTABLEPTR,ALIGNMENT_HSSTABLEPTR,
readStablePtrOffPtr,writeStablePtrOffPtr)
+-- | @since 2.01
STORABLE(Float,SIZEOF_HSFLOAT,ALIGNMENT_HSFLOAT,
readFloatOffPtr,writeFloatOffPtr)
+-- | @since 2.01
STORABLE(Double,SIZEOF_HSDOUBLE,ALIGNMENT_HSDOUBLE,
readDoubleOffPtr,writeDoubleOffPtr)
+-- | @since 2.01
STORABLE(Word8,SIZEOF_WORD8,ALIGNMENT_WORD8,
readWord8OffPtr,writeWord8OffPtr)
+-- | @since 2.01
STORABLE(Word16,SIZEOF_WORD16,ALIGNMENT_WORD16,
readWord16OffPtr,writeWord16OffPtr)
+-- | @since 2.01
STORABLE(Word32,SIZEOF_WORD32,ALIGNMENT_WORD32,
readWord32OffPtr,writeWord32OffPtr)
+-- | @since 2.01
STORABLE(Word64,SIZEOF_WORD64,ALIGNMENT_WORD64,
readWord64OffPtr,writeWord64OffPtr)
+-- | @since 2.01
STORABLE(Int8,SIZEOF_INT8,ALIGNMENT_INT8,
readInt8OffPtr,writeInt8OffPtr)
+-- | @since 2.01
STORABLE(Int16,SIZEOF_INT16,ALIGNMENT_INT16,
readInt16OffPtr,writeInt16OffPtr)
+-- | @since 2.01
STORABLE(Int32,SIZEOF_INT32,ALIGNMENT_INT32,
readInt32OffPtr,writeInt32OffPtr)
+-- | @since 2.01
STORABLE(Int64,SIZEOF_INT64,ALIGNMENT_INT64,
readInt64OffPtr,writeInt64OffPtr)
+-- | @since 4.8.0.0
instance (Storable a, Integral a) => Storable (Ratio a) where
sizeOf _ = 2 * sizeOf (undefined :: a)
alignment _ = alignment (undefined :: a )
@@ -228,6 +247,7 @@ instance (Storable a, Integral a) => Storable (Ratio a) where
pokeElemOff q 1 i
-- XXX: here to avoid orphan instance in GHC.Fingerprint
+-- | @since 4.4.0.0
instance Storable Fingerprint where
sizeOf _ = 16
alignment _ = 8