Copyright | (c) The University of Glasgow 2001 |
---|---|
License | BSD-style (see the file libraries/base/LICENSE) |
Maintainer | libraries@haskell.org |
Stability | stable |
Portability | non-portable (uses Control.Monad.ST.Lazy) |
Safe Haskell | Safe |
Language | Haskell2010 |
Mutable references in the lazy ST monad.
STRefs
a value of type STRef s a
is a mutable variable in state thread s
,
containing a value of type a
>>>
:{
runST (do ref <- newSTRef "hello" x <- readSTRef ref writeSTRef ref (x ++ "world") readSTRef ref ) :} "helloworld"
writeSTRef :: STRef s a -> a -> ST s () Source #
modifySTRef :: STRef s a -> (a -> a) -> ST s () Source #