diff options
author | Hécate Moonlight <hecate+gitlab@glitchbra.in> | 2022-01-20 21:55:16 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-02-04 16:14:10 -0500 |
commit | 4bd52410d03f851f69f85d43855358733d5ceb6d (patch) | |
tree | 5d64eda4df2fa904b1a4062e7cff7287cf6e6ec1 | |
parent | 62d670eb3a1c059f1ff977471f8d77dac5cf21b8 (diff) | |
download | haskell-4bd52410d03f851f69f85d43855358733d5ceb6d.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
-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 | 5 | ||||
-rw-r--r-- | libraries/base/include/CTypes.h | 2 |
5 files changed, 10 insertions, 2 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 0a9915feff..44ac94c32b 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -38,6 +38,11 @@ * Any Haskell type that wraps a C pointer type has been changed from `Ptr ()` to `CUIntPtr`. For typical glibc based platforms, the affected type is `CTimer`. + * 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* 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); |