W3cubDocs

/Haskell 8

Data.STRef.Lazy

Copyright (c) The University of Glasgow 2001
License BSD-style (see the file libraries/base/LICENSE)
Maintainer [email protected]
Stability experimental
Portability non-portable (uses Control.Monad.ST.Lazy)
Safe Haskell Safe
Language Haskell2010

Contents

Description

Mutable references in the lazy ST monad.

STRefs

data STRef s a Source

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"
Instances
Instances details
Eq (STRef s a)

Pointer equality.

Since: base-2.1

Instance details

Defined in GHC.STRef

Methods

(==) :: STRef s a -> STRef s a -> Bool Source

(/=) :: STRef s a -> STRef s a -> Bool Source

newSTRef :: a -> ST s (STRef s a) Source

readSTRef :: STRef s a -> ST s a Source

writeSTRef :: STRef s a -> a -> ST s () Source

modifySTRef :: STRef s a -> (a -> a) -> ST s () Source

© The University of Glasgow and others
Licensed under a BSD-style license (see top of the page).
https://downloads.haskell.org/~ghc/8.8.3/docs/html/libraries/base-4.13.0.0/Data-STRef-Lazy.html