[commit: packages/deepseq] master, typeable-with-kinds: `NFData` instances for `TyCon` and `TypeRep` (50b5f3f)
git at git.haskell.org
git at git.haskell.org
Thu Mar 19 11:35:35 UTC 2015
Repository : ssh://git@git.haskell.org/deepseq
On branches: master,typeable-with-kinds
Link : http://git.haskell.org/packages/deepseq.git/commitdiff/50b5f3fba01a8ef3b1f86e6a82817238d03c76d4
>---------------------------------------------------------------
commit 50b5f3fba01a8ef3b1f86e6a82817238d03c76d4
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date: Tue Nov 25 12:00:38 2014 +0100
`NFData` instances for `TyCon` and `TypeRep`
>---------------------------------------------------------------
50b5f3fba01a8ef3b1f86e6a82817238d03c76d4
Control/DeepSeq.hs | 16 ++++++++++++++++
changelog.md | 3 +++
2 files changed, 19 insertions(+)
diff --git a/Control/DeepSeq.hs b/Control/DeepSeq.hs
index 0472277..aaef007 100644
--- a/Control/DeepSeq.hs
+++ b/Control/DeepSeq.hs
@@ -73,6 +73,8 @@ import Data.Proxy ( Proxy(Proxy) )
#if MIN_VERSION_base(4,8,0)
import Data.Functor.Identity ( Identity(..) )
+-- NB: Data.Typeable.Internal is "Trustworthy" only starting w/ base-4.8
+import Data.Typeable.Internal ( TypeRep(..), TyCon(..) )
import Numeric.Natural ( Natural )
#endif
@@ -328,6 +330,20 @@ instance NFData a => NFData (Sum a) where
instance NFData a => NFData (Product a) where
rnf = rnf . getProduct
+#if MIN_VERSION_base(4,8,0)
+-- | __NOTE__: Only defined for @base-4.8.0.0@ and later
+--
+-- /Since: 1.4.0.0/
+instance NFData TypeRep where
+ rnf (TypeRep _ tycon tyrep) = rnf tycon `seq` rnf tyrep
+
+-- | __NOTE__: Only defined for @base-4.8.0.0@ and later
+--
+-- /Since: 1.4.0.0/
+instance NFData TyCon where
+ rnf (TyCon _ tcp tcm tcn) = rnf tcp `seq` rnf tcm `seq` rnf tcn
+#endif
+
----------------------------------------------------------------------------
-- GHC Specifics
diff --git a/changelog.md b/changelog.md
index be83f71..8b14bd9 100644
--- a/changelog.md
+++ b/changelog.md
@@ -22,6 +22,9 @@
- `Data.Functor.Identity.Identity`
- `Data.Monoid.{Dual,First,Last,Any,All,Sum,Product}`
- `Data.Proxy.Proxy`
+ - `Data.Typeable.Internal.TyCon`
+ - `Data.Typeable.Internal.TypeRep`
+ - `GHC.Fingerprint.Type.Fingerprint`
- `Numeric.Natural.Natural`
## 1.3.0.2 *Nov 2013*
More information about the ghc-commits
mailing list