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