[commit: packages/deepseq] master: Add NFData{1, 2} instances for (:~:) and (:~~:) (af54b3e)

git at git.haskell.org git at git.haskell.org
Wed Jul 19 21:59:38 UTC 2017


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

On branch  : master
Link       : http://git.haskell.org/packages/deepseq.git/commitdiff/af54b3e2e91e02db9206dc8433a8b81cb111e35f

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

commit af54b3e2e91e02db9206dc8433a8b81cb111e35f
Author: Ryan Scott <ryan.gl.scott at gmail.com>
Date:   Sat Apr 8 13:56:44 2017 -0400

    Add NFData{1,2} instances for (:~:) and (:~~:)


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

af54b3e2e91e02db9206dc8433a8b81cb111e35f
 Control/DeepSeq.hs | 17 +++++++++++++++++
 changelog.md       |  2 ++
 2 files changed, 19 insertions(+)

diff --git a/Control/DeepSeq.hs b/Control/DeepSeq.hs
index 4c5505e..26167af 100644
--- a/Control/DeepSeq.hs
+++ b/Control/DeepSeq.hs
@@ -92,6 +92,7 @@ import Data.Ord ( Down(Down) )
 
 #if MIN_VERSION_base(4,7,0)
 import Data.Proxy ( Proxy(Proxy) )
+import Data.Type.Equality
 #endif
 
 #if MIN_VERSION_base(4,8,0)
@@ -388,6 +389,22 @@ instance NFData Word64   where rnf = rwhnf
 instance NFData (Proxy a) where rnf Proxy = ()
 -- |@since 1.4.3.0
 instance NFData1 Proxy    where liftRnf _ Proxy = ()
+
+-- | @since 1.4.3.0
+instance NFData (a :~: b) where rnf = rwhnf
+-- | @since 1.4.3.0
+instance NFData1 ((:~:) a) where liftRnf _ = rwhnf
+-- | @since 1.4.3.0
+instance NFData2 (:~:) where liftRnf2 _ _ = rwhnf
+#endif
+
+#if MIN_VERSION_base(4,10,0)
+-- | @since 1.4.3.0
+instance NFData (a :~~: b) where rnf = rwhnf
+-- | @since 1.4.3.0
+instance NFData1 ((:~~:) a) where liftRnf _ = rwhnf
+-- | @since 1.4.3.0
+instance NFData2 (:~~:) where liftRnf2 _ _ = rwhnf
 #endif
 
 #if MIN_VERSION_base(4,8,0)
diff --git a/changelog.md b/changelog.md
index 8f95f22..fef1ead 100644
--- a/changelog.md
+++ b/changelog.md
@@ -15,6 +15,8 @@
   * Add `NFData1` and `NFData2` type classes ([#8](https://github.com/haskell/deepseq/issues/8))
   * Add `NFData1` and `NFData` instances for `Data.Functor.{Compose,Sum,Product}`
     ([#30](https://github.com/haskell/deepseq/pull/30))
+  * Add `NFData`, `NFData1`, and `NFData2` instances for `(:~:)` and `(:~~:)`
+    from `Data.Type.Equality` ([#31](https://github.com/haskell/deepseq/issues/31))
 
 ## 1.4.2.0  *Apr 2016*
 



More information about the ghc-commits mailing list