3 -----------------------------------------------------------------------------
6 -- Copyright : (c) The University of Glasgow 2001
7 -- License : BSD-style (see the file libraries/base/LICENSE)
9 -- Maintainer : libraries@haskell.org
10 -- Stability : experimental
11 -- Portability : non-portable (uses Control.Monad.ST)
13 -- Mutable references in the (strict) ST monad.
15 -----------------------------------------------------------------------------
19 STRef, -- abstract, instance Eq
20 newSTRef, -- :: a -> ST s (STRef s a)
21 readSTRef, -- :: STRef s a -> ST s a
22 writeSTRef, -- :: STRef s a -> a -> ST s ()
23 modifySTRef -- :: STRef s a -> (a -> a) -> ST s ()
28 #ifdef __GLASGOW_HASKELL__
38 INSTANCE_TYPEABLE2(STRef,stRefTc,"STRef")
41 -- |Mutate the contents of an 'STRef'
42 modifySTRef :: STRef s a -> (a -> a) -> ST s ()
43 modifySTRef ref f = writeSTRef ref . f =<< readSTRef ref