projects
/
ghc-base.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add tests from testsuite/tests/h98
[ghc-base.git]
/
GHC
/
STRef.lhs
diff --git
a/GHC/STRef.lhs
b/GHC/STRef.lhs
index
5eecb85
..
9306b24
100644
(file)
--- a/
GHC/STRef.lhs
+++ b/
GHC/STRef.lhs
@@
-1,5
+1,7
@@
\begin{code}
\begin{code}
-{-# OPTIONS -fno-implicit-prelude #-}
+{-# LANGUAGE NoImplicitPrelude, MagicHash, UnboxedTuples #-}
+{-# OPTIONS_HADDOCK hide #-}
+
-----------------------------------------------------------------------------
-- |
-- Module : GHC.STRef
-----------------------------------------------------------------------------
-- |
-- Module : GHC.STRef
@@
-14,6
+16,7
@@
--
-----------------------------------------------------------------------------
--
-----------------------------------------------------------------------------
+-- #hide
module GHC.STRef where
import GHC.ST
module GHC.STRef where
import GHC.ST
@@
-39,10
+42,6
@@
writeSTRef (STRef var#) val = ST $ \s1# ->
case writeMutVar# var# val s1# of { s2# ->
(# s2#, () #) }
case writeMutVar# var# val s1# of { s2# ->
(# s2#, () #) }
--- |Mutate the contents of an 'STRef'
-modifySTRef :: STRef s a -> (a -> a) -> ST s ()
-modifySTRef ref f = readSTRef ref >>= writeSTRef ref . f
-
-- Just pointer equality on mutable references:
instance Eq (STRef s a) where
STRef v1# == STRef v2# = sameMutVar# v1# v2#
-- Just pointer equality on mutable references:
instance Eq (STRef s a) where
STRef v1# == STRef v2# = sameMutVar# v1# v2#