{-# LANGUAGE Safe #-}

-----------------------------------------------------------------------------
-- |
-- Module      :  Data.STRef.Lazy
-- Copyright   :  (c) The University of Glasgow 2001
-- License     :  BSD-style (see the file libraries/base/LICENSE)
-- 
-- Maintainer  :  libraries@haskell.org
-- Stability   :  experimental
-- Portability :  non-portable (uses Control.Monad.ST.Lazy)
--
-- Mutable references in the lazy ST monad.
--
-----------------------------------------------------------------------------

module Data.STRef.Lazy (
        -- * STRefs
        ST.STRef,       -- abstract
        newSTRef,
        readSTRef,
        writeSTRef,
        modifySTRef
 ) where

import Control.Monad.ST.Lazy
import qualified Data.STRef as ST

newSTRef    :: a -> ST s (ST.STRef s a)
readSTRef   :: ST.STRef s a -> ST s a
writeSTRef  :: ST.STRef s a -> a -> ST s ()
modifySTRef :: ST.STRef s a -> (a -> a) -> ST s ()

newSTRef :: forall a s. a -> ST s (STRef s a)
newSTRef        = forall s a. ST s a -> ST s a
strictToLazyST forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a s. a -> ST s (STRef s a)
ST.newSTRef
readSTRef :: forall s a. STRef s a -> ST s a
readSTRef       = forall s a. ST s a -> ST s a
strictToLazyST forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall s a. STRef s a -> ST s a
ST.readSTRef
writeSTRef :: forall s a. STRef s a -> a -> ST s ()
writeSTRef  STRef s a
r a
a = forall s a. ST s a -> ST s a
strictToLazyST (forall s a. STRef s a -> a -> ST s ()
ST.writeSTRef STRef s a
r a
a)
modifySTRef :: forall s a. STRef s a -> (a -> a) -> ST s ()
modifySTRef STRef s a
r a -> a
f = forall s a. ST s a -> ST s a
strictToLazyST (forall s a. STRef s a -> (a -> a) -> ST s ()
ST.modifySTRef STRef s a
r a -> a
f)