diff options
author | Hécate Moonlight <hecate+gitlab@glitchbra.in> | 2022-01-20 21:55:16 +0100 |
---|---|---|
committer | Matthew Pickering <matthewtpickering@gmail.com> | 2022-02-11 10:10:43 +0000 |
commit | dd4f50d8f7c610660a136fca33ed1599aa632470 (patch) | |
tree | d0f0fafbb99f42ab0281f3727847273b7370749a | |
parent | e9213f63f3d706aefbea77c9480337565235ca3d (diff) | |
download | haskell-dd4f50d8f7c610660a136fca33ed1599aa632470.tar.gz |
Add the Ix class to Foreign C integral types
Related CLC proposal is here: https://github.com/haskell/core-libraries-committee/issues/30
(cherry picked from commit 4bd52410d03f851f69f85d43855358733d5ceb6d)
-rw-r--r-- | libraries/base/Foreign/C/Types.hs | 1 | ||||
-rw-r--r-- | libraries/base/Foreign/Ptr.hs | 1 | ||||
-rw-r--r-- | libraries/base/System/Posix/Types.hs | 3 | ||||
-rw-r--r-- | libraries/base/changelog.md | 9 | ||||
-rw-r--r-- | libraries/base/include/CTypes.h | 2 |
5 files changed, 13 insertions, 3 deletions
diff --git a/libraries/base/Foreign/C/Types.hs b/libraries/base/Foreign/C/Types.hs index d2f3245b11..84139d4839 100644 --- a/libraries/base/Foreign/C/Types.hs +++ b/libraries/base/Foreign/C/Types.hs @@ -98,6 +98,7 @@ import GHC.Real import GHC.Show import GHC.Read import GHC.Num +import GHC.Ix #include "HsBaseConfig.h" #include "CTypes.h" diff --git a/libraries/base/Foreign/Ptr.hs b/libraries/base/Foreign/Ptr.hs index 2607448f2a..59482e1737 100644 --- a/libraries/base/Foreign/Ptr.hs +++ b/libraries/base/Foreign/Ptr.hs @@ -62,6 +62,7 @@ import GHC.Read import GHC.Real import GHC.Show import GHC.Enum +import GHC.Ix import Data.Bits import Foreign.Storable ( Storable(..) ) diff --git a/libraries/base/System/Posix/Types.hs b/libraries/base/System/Posix/Types.hs index d3654fef86..a69649d403 100644 --- a/libraries/base/System/Posix/Types.hs +++ b/libraries/base/System/Posix/Types.hs @@ -134,10 +134,11 @@ import Foreign.C import GHC.Base import GHC.Enum +import GHC.Ix import GHC.Num +import GHC.Read import GHC.Real -- import GHC.Prim -import GHC.Read import GHC.Show #include "CTypes.h" diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index bcc733476f..8696773122 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -1,5 +1,12 @@ # Changelog for [`base` package](http://hackage.haskell.org/package/base) -\ + +## 4.16.1.0 *TBA* + + * The following Foreign C types now have an instance of `Ix`: + CChar, CSChar, CUChar, CShort, CUShort, CInt, CUInt, CLong, CULong, + CPtrdiff, CSize, CWchar, CSigAtomic, CLLong, CULLong, CBool, CIntPtr, CUIntPtr, + CIntMax, CUIntMax. + ## 4.16.0.0 *Nov 2021* * Shipped with GHC 9.2.1 diff --git a/libraries/base/include/CTypes.h b/libraries/base/include/CTypes.h index 7bb3dbdc73..92084c78b4 100644 --- a/libraries/base/include/CTypes.h +++ b/libraries/base/include/CTypes.h @@ -25,7 +25,7 @@ newtype {-# CTYPE THE_CTYPE #-} T = T B deriving newtype (Read, Show, ARITHMETIC #define INTEGRAL_TYPE(T,THE_CTYPE,B) \ newtype {-# CTYPE THE_CTYPE #-} T = T B \ - deriving newtype (Read, Show, ARITHMETIC_CLASSES, INTEGRAL_CLASSES); + deriving newtype (Read, Show, ARITHMETIC_CLASSES, INTEGRAL_CLASSES, Ix); #define FLOATING_TYPE(T,THE_CTYPE,B) \ newtype {-# CTYPE THE_CTYPE #-} T = T B deriving newtype (Read, Show, ARITHMETIC_CLASSES, FLOATING_CLASSES); |