[commit: packages/deepseq] master, typeable-with-kinds: Add `NFData` instances for `Foreign.C.Types` (8dc617d)

git at git.haskell.org git at git.haskell.org
Thu Mar 19 11:35:39 UTC 2015


Repository : ssh://git@git.haskell.org/deepseq

On branches: master,typeable-with-kinds
Link       : http://git.haskell.org/packages/deepseq.git/commitdiff/8dc617dad456e16c67b0f629495dcf266a58ab0a

>---------------------------------------------------------------

commit 8dc617dad456e16c67b0f629495dcf266a58ab0a
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Tue Nov 25 12:35:16 2014 +0100

    Add `NFData` instances for `Foreign.C.Types`


>---------------------------------------------------------------

8dc617dad456e16c67b0f629495dcf266a58ab0a
 Control/DeepSeq.hs | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 changelog.md       |  1 +
 2 files changed, 95 insertions(+), 1 deletion(-)

diff --git a/Control/DeepSeq.hs b/Control/DeepSeq.hs
index aad5c9c..dfefe3e 100644
--- a/Control/DeepSeq.hs
+++ b/Control/DeepSeq.hs
@@ -66,7 +66,7 @@ import Data.Array
 import Data.Fixed
 import Data.Version
 import Data.Monoid
-
+import Foreign.C.Types
 import System.Mem.StableName ( StableName )
 
 #if MIN_VERSION_base(4,7,0)
@@ -360,6 +360,99 @@ instance NFData Fingerprint where
 #endif
 
 ----------------------------------------------------------------------------
+-- Foreign.C.Types
+
+-- |/Since: 1.4.0.0/
+instance NFData CChar where rnf !_ = ()
+
+-- |/Since: 1.4.0.0/
+instance NFData CSChar where rnf !_ = ()
+
+-- |/Since: 1.4.0.0/
+instance NFData CUChar where rnf !_ = ()
+
+-- |/Since: 1.4.0.0/
+instance NFData CShort where rnf !_ = ()
+
+-- |/Since: 1.4.0.0/
+instance NFData CUShort where rnf !_ = ()
+
+-- |/Since: 1.4.0.0/
+instance NFData CInt where rnf !_ = ()
+
+-- |/Since: 1.4.0.0/
+instance NFData CUInt where rnf !_ = ()
+
+-- |/Since: 1.4.0.0/
+instance NFData CLong where rnf !_ = ()
+
+-- |/Since: 1.4.0.0/
+instance NFData CULong where rnf !_ = ()
+
+-- |/Since: 1.4.0.0/
+instance NFData CPtrdiff where rnf !_ = ()
+
+-- |/Since: 1.4.0.0/
+instance NFData CSize where rnf !_ = ()
+
+-- |/Since: 1.4.0.0/
+instance NFData CWchar where rnf !_ = ()
+
+-- |/Since: 1.4.0.0/
+instance NFData CSigAtomic where rnf !_ = ()
+
+-- |/Since: 1.4.0.0/
+instance NFData CLLong where rnf !_ = ()
+
+-- |/Since: 1.4.0.0/
+instance NFData CULLong where rnf !_ = ()
+
+-- |/Since: 1.4.0.0/
+instance NFData CIntPtr where rnf !_ = ()
+
+-- |/Since: 1.4.0.0/
+instance NFData CUIntPtr where rnf !_ = ()
+
+-- |/Since: 1.4.0.0/
+instance NFData CIntMax where rnf !_ = ()
+
+-- |/Since: 1.4.0.0/
+instance NFData CUIntMax where rnf !_ = ()
+
+-- |/Since: 1.4.0.0/
+instance NFData CClock where rnf !_ = ()
+
+-- |/Since: 1.4.0.0/
+instance NFData CTime where rnf !_ = ()
+
+#if MIN_VERSION_base(4,4,0)
+-- |/Since: 1.4.0.0/
+instance NFData CUSeconds where rnf !_ = ()
+
+-- |/Since: 1.4.0.0/
+instance NFData CSUSeconds where rnf !_ = ()
+#endif
+
+-- |/Since: 1.4.0.0/
+instance NFData CFloat where rnf !_ = ()
+
+-- |/Since: 1.4.0.0/
+instance NFData CDouble where rnf !_ = ()
+
+-- NOTE: The types `CFile`, `CFPos`, and `CJmpBuf` below are not
+-- newtype wrappers rather defined as field-less single-constructor
+-- types.
+
+-- |/Since: 1.4.0.0/
+instance NFData CFile where rnf !_ = ()
+
+-- |/Since: 1.4.0.0/
+instance NFData CFpos where rnf !_ = ()
+
+-- |/Since: 1.4.0.0/
+instance NFData CJmpBuf where rnf !_ = ()
+
+----------------------------------------------------------------------------
 -- Tuples
 
 instance (NFData a, NFData b) => NFData (a,b) where
diff --git a/changelog.md b/changelog.md
index b938e4c..c2bfa84 100644
--- a/changelog.md
+++ b/changelog.md
@@ -27,6 +27,7 @@
      - `GHC.Fingerprint.Type.Fingerprint`
      - `Numeric.Natural.Natural`
      - `System.Mem.StableName.StableName`
+     - `Foreign.C.Types.C*`
 
 ## 1.3.0.2  *Nov 2013*
 



More information about the ghc-commits mailing list