Update base for latest Safe Haskell.
[packages/base.git] / Data / STRef / Lazy.hs
1 {-# LANGUAGE Safe #-}
2
3 -----------------------------------------------------------------------------
4 -- |
5 -- Module : Data.STRef.Lazy
6 -- Copyright : (c) The University of Glasgow 2001
7 -- License : BSD-style (see the file libraries/base/LICENSE)
8 --
9 -- Maintainer : libraries@haskell.org
10 -- Stability : experimental
11 -- Portability : non-portable (uses Control.Monad.ST.Lazy)
12 --
13 -- Mutable references in the lazy ST monad.
14 --
15 -----------------------------------------------------------------------------
16
17 module Data.STRef.Lazy (
18 -- * STRefs
19 ST.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 ()
24 ) where
25
26 import Control.Monad.ST.Lazy.Safe
27 import qualified Data.STRef as ST
28 import Prelude
29
30 newSTRef :: a -> ST s (ST.STRef s a)
31 readSTRef :: ST.STRef s a -> ST s a
32 writeSTRef :: ST.STRef s a -> a -> ST s ()
33 modifySTRef :: ST.STRef s a -> (a -> a) -> ST s ()
34
35 newSTRef = strictToLazyST . ST.newSTRef
36 readSTRef = strictToLazyST . ST.readSTRef
37 writeSTRef r a = strictToLazyST (ST.writeSTRef r a)
38 modifySTRef r f = strictToLazyST (ST.modifySTRef r f)
39