{-# LANGUAGE Safe #-}
module Data.STRef.Lazy (
ST.STRef,
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 :: a -> ST s (STRef s a)
newSTRef = ST s (STRef s a) -> ST s (STRef s a)
forall s a. ST s a -> ST s a
strictToLazyST (ST s (STRef s a) -> ST s (STRef s a))
-> (a -> ST s (STRef s a)) -> a -> ST s (STRef s a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> ST s (STRef s a)
forall a s. a -> ST s (STRef s a)
ST.newSTRef
readSTRef :: STRef s a -> ST s a
readSTRef = ST s a -> ST s a
forall s a. ST s a -> ST s a
strictToLazyST (ST s a -> ST s a) -> (STRef s a -> ST s a) -> STRef s a -> ST s a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. STRef s a -> ST s a
forall s a. STRef s a -> ST s a
ST.readSTRef
writeSTRef :: STRef s a -> a -> ST s ()
writeSTRef r :: STRef s a
r a :: a
a = ST s () -> ST s ()
forall s a. ST s a -> ST s a
strictToLazyST (STRef s a -> a -> ST s ()
forall s a. STRef s a -> a -> ST s ()
ST.writeSTRef STRef s a
r a
a)
modifySTRef :: STRef s a -> (a -> a) -> ST s ()
modifySTRef r :: STRef s a
r f :: a -> a
f = ST s () -> ST s ()
forall s a. ST s a -> ST s a
strictToLazyST (STRef s a -> (a -> a) -> ST s ()
forall s a. STRef s a -> (a -> a) -> ST s ()
ST.modifySTRef STRef s a
r a -> a
f)