[commit: packages/deepseq] master, typeable-with-kinds: Add `NFData` instance for `Const` & `ZipList` (6188247)
git at git.haskell.org
git at git.haskell.org
Thu Mar 19 11:35:29 UTC 2015
Repository : ssh://git@git.haskell.org/deepseq
On branches: master,typeable-with-kinds
Link : http://git.haskell.org/packages/deepseq.git/commitdiff/61882473cc857e489ec52277204084199a982f76
>---------------------------------------------------------------
commit 61882473cc857e489ec52277204084199a982f76
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date: Sun Nov 23 17:25:39 2014 +0100
Add `NFData` instance for `Const` & `ZipList`
>---------------------------------------------------------------
61882473cc857e489ec52277204084199a982f76
Control/DeepSeq.hs | 9 +++++++++
changelog.md | 4 +++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/Control/DeepSeq.hs b/Control/DeepSeq.hs
index 6b4906f..c6fc69d 100644
--- a/Control/DeepSeq.hs
+++ b/Control/DeepSeq.hs
@@ -57,6 +57,7 @@ module Control.DeepSeq (
NFData(..),
) where
+import Control.Applicative
import Data.Int
import Data.Word
import Data.Ratio
@@ -267,6 +268,14 @@ instance NFData a => NFData [a] where
rnf [] = ()
rnf (x:xs) = rnf x `seq` rnf xs
+-- |/Since: 1.4.0.0/
+instance NFData a => NFData (ZipList a) where
+ rnf = rnf . getZipList
+
+-- |/Since: 1.4.0.0/
+instance NFData a => NFData (Const a b) where
+ rnf = rnf . getConst
+
instance (Ix a, NFData a, NFData b) => NFData (Array a b) where
rnf x = rnf (bounds x, Data.Array.elems x)
diff --git a/changelog.md b/changelog.md
index 1e6c805..be83f71 100644
--- a/changelog.md
+++ b/changelog.md
@@ -17,10 +17,12 @@
* New `NFData` instances for `base` types:
+ - `Control.Applicative.Const`
+ - `Control.Applicative.ZipList`
- `Data.Functor.Identity.Identity`
+ - `Data.Monoid.{Dual,First,Last,Any,All,Sum,Product}`
- `Data.Proxy.Proxy`
- `Numeric.Natural.Natural`
- - `Data.Monoid.{Dual,First,Last,Any,All,Sum,Product}`
## 1.3.0.2 *Nov 2013*
More information about the ghc-commits
mailing list