[commit: packages/deepseq] master: Add instance for IORef and MVar (7367507)
git at git.haskell.org
git at git.haskell.org
Wed Apr 20 13:05:08 UTC 2016
Repository : ssh://git@git.haskell.org/deepseq
On branch : master
Link : http://git.haskell.org/packages/deepseq.git/commitdiff/7367507ea499a05bd8976f3bd694ac014d2b27d9
>---------------------------------------------------------------
commit 7367507ea499a05bd8976f3bd694ac014d2b27d9
Author: Eric Mertens <emertens at gmail.com>
Date: Mon Oct 12 23:33:01 2015 -0700
Add instance for IORef and MVar
Advances #6
>---------------------------------------------------------------
7367507ea499a05bd8976f3bd694ac014d2b27d9
Control/DeepSeq.hs | 15 ++++++++++++++-
changelog.md | 3 +++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/Control/DeepSeq.hs b/Control/DeepSeq.hs
index bcd5efc..cec8207 100644
--- a/Control/DeepSeq.hs
+++ b/Control/DeepSeq.hs
@@ -61,7 +61,8 @@ module Control.DeepSeq (
) where
import Control.Applicative
-import Control.Concurrent ( ThreadId )
+import Control.Concurrent ( ThreadId, MVar )
+import Data.IORef
import Data.Int
import Data.Word
import Data.Ratio
@@ -412,6 +413,18 @@ instance NFData TyCon where
rnf tycon = rnfTyCon tycon
#endif
+-- | __NOTE__: Only strict in the reference and not the referenced value.
+--
+-- /Since: 1.4.2.0/
+instance NFData (IORef a) where
+ rnf !_ = ()
+
+-- | __NOTE__: Only strict in the reference and not the referenced value.
+--
+-- /Since: 1.4.2.0/
+instance NFData (MVar a) where
+ rnf !_ = ()
+
----------------------------------------------------------------------------
-- GHC Specifics
diff --git a/changelog.md b/changelog.md
index a700165..794d5ee 100644
--- a/changelog.md
+++ b/changelog.md
@@ -5,6 +5,9 @@
* Added instances for `Ptr` and `FunPtr`
([#10](https://github.com/haskell/deepseq/pull/10))
+ * Added instance for `IORef` and `MVar`
+ ([#6](https://github.com/haskell/deepseq/issues/6))
+
## 1.4.1.2 *Aug 2015*
* Avoid the broken combination of GHC-7.2 with `array>=0.4`
More information about the ghc-commits
mailing list