[commit: packages/deepseq] master: Add instance NFData (STRef s a) (33913fb)
git at git.haskell.org
git at git.haskell.org
Wed Apr 20 13:05:12 UTC 2016
Repository : ssh://git@git.haskell.org/deepseq
On branch : master
Link : http://git.haskell.org/packages/deepseq.git/commitdiff/33913fbccd67c8edf61ce6048152858aef2e399a
>---------------------------------------------------------------
commit 33913fbccd67c8edf61ce6048152858aef2e399a
Author: Eric Mertens <emertens at gmail.com>
Date: Mon Oct 12 23:49:34 2015 -0700
Add instance NFData (STRef s a)
Advances #10
>---------------------------------------------------------------
33913fbccd67c8edf61ce6048152858aef2e399a
Control/DeepSeq.hs | 7 +++++++
changelog.md | 2 +-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/Control/DeepSeq.hs b/Control/DeepSeq.hs
index ff3252d..d6481d6 100644
--- a/Control/DeepSeq.hs
+++ b/Control/DeepSeq.hs
@@ -63,6 +63,7 @@ module Control.DeepSeq (
import Control.Applicative
import Control.Concurrent ( ThreadId, MVar )
import Data.IORef
+import Data.STRef
import Data.Int
import Data.Word
import Data.Ratio
@@ -423,6 +424,12 @@ instance NFData (IORef a) where
-- | __NOTE__: Only strict in the reference and not the referenced value.
--
-- /Since: 1.4.2.0/
+instance NFData (STRef s 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 !_ = ()
diff --git a/changelog.md b/changelog.md
index 29a222d..5c6abe1 100644
--- a/changelog.md
+++ b/changelog.md
@@ -5,7 +5,7 @@
* Added instances for `Ptr` and `FunPtr`
([#10](https://github.com/haskell/deepseq/pull/10))
- * Added instances for `IORef` and `MVar`
+ * Added instances for `IORef`, `STRef`, and `MVar`
([#6](https://github.com/haskell/deepseq/issues/6))
* Added instance for `ExitCode`
More information about the ghc-commits
mailing list