[commit: packages/deepseq] master, typeable-with-kinds: Add `NFData` instance for `Identity` functor (#2) (9e95a3b)

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


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

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

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

commit 9e95a3b18fa8ff12c6704070b52ac2eae9642c67
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Sun Nov 23 17:03:56 2014 +0100

    Add `NFData` instance for `Identity` functor (#2)


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

9e95a3b18fa8ff12c6704070b52ac2eae9642c67
 Control/DeepSeq.hs | 5 +++++
 changelog.md       | 4 +++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/Control/DeepSeq.hs b/Control/DeepSeq.hs
index c374a6c..aebc5ba 100644
--- a/Control/DeepSeq.hs
+++ b/Control/DeepSeq.hs
@@ -70,6 +70,7 @@ import Data.Proxy ( Proxy(Proxy) )
 #endif
 
 #if MIN_VERSION_base(4,8,0)
+import Data.Functor.Identity ( Identity(..) )
 import Numeric.Natural ( Natural )
 #endif
 
@@ -223,6 +224,10 @@ instance NFData (Proxy a) where rnf Proxy = ()
 
 #if MIN_VERSION_base(4,8,0)
 -- |/Since: 1.4.0.0/
+instance NFData a => NFData (Identity a) where
+    rnf = rnf . runIdentity
+
+-- |/Since: 1.4.0.0/
 instance NFData Natural  where rnf !_ = ()
 #endif
 
diff --git a/changelog.md b/changelog.md
index 891cd89..73490e3 100644
--- a/changelog.md
+++ b/changelog.md
@@ -16,8 +16,10 @@
         instance NFData XYZ where rnf x = seq x ()
 
   * New `NFData` instances for `base` types:
-     - `Numeric.Natural.Natural`
+  
+     - `Data.Functor.Identity.Identity`
      - `Data.Proxy.Proxy`
+     - `Numeric.Natural.Natural`
 
 ## 1.3.0.2  *Nov 2013*
 



More information about the ghc-commits mailing list