[project @ 2002-07-16 16:08:58 by ross]
[packages/old-locale.git] / Data / STRef / Lazy.hs
1 -----------------------------------------------------------------------------
2 -- |
3 -- Module : Data.STRef.Lazy
4 -- Copyright : (c) The University of Glasgow 2001
5 -- License : BSD-style (see the file libraries/base/LICENSE)
6 --
7 -- Maintainer : libraries@haskell.org
8 -- Stability : experimental
9 -- Portability : non-portable (requires non-portable module ST)
10 --
11 -- Mutable references in the lazy ST monad.
12 --
13 -----------------------------------------------------------------------------
14 module Data.STRef.Lazy (
15 -- * STRefs
16 ST.STRef, -- abstract, instance Eq
17 newSTRef, -- :: a -> ST s (STRef s a)
18 readSTRef, -- :: STRef s a -> ST s a
19 writeSTRef, -- :: STRef s a -> a -> ST s ()
20 modifySTRef -- :: STRef s a -> (a -> a) -> ST s ()
21 ) where
22
23 import Control.Monad.ST.Lazy
24 #ifdef __HUGS__
25 import Hugs.LazyST as ST
26 #else
27 import qualified Data.STRef as ST
28 import qualified Control.Monad.ST as ST
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
40 #endif /* __HUGS__ */