HORIZON HASKELLDocslts/ghc-10.0.xfc4e5982026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · fc4e598 · 2026-10-11

Moduleeffectful-2.7.1.0GHC2021

Effectful.Prim.IORef

Lifted Data.IORef.

Note: it requires Prim because MutVar from the primitive library is a generalization of IORef.

  • 2 types
  • 10 values

Effect

1 declaration
datadata Prim (a :: Type -> Type) b
#

Provide the ability to perform primitive state-transformer actions.

Instances2DispatchOf, StaticRep

Handlers

IORef

10 declarations
newtypenewtype IORef a
#

A mutable variable in the IO monad.

Example11 expressions
import GHC.Internal.Data.IORefr <- newIORef 0readIORef r0writeIORef r 1readIORef r1atomicWriteIORef r 2readIORef r2modifyIORef' r (+ 1)readIORef r3atomicModifyIORef' r (\a -> (a + 1, ()))readIORef r4

See also STRef and MVar.

Instances3NFData1, Eq, NFData
  • NFData1 IORefDefined in deepseq-1.5.2.0 · Control.DeepSeq
  • Eq (IORef a)Defined in ghc-internal-10.0.0 · GHC.Internal.IORef

    Pointer equality.

  • NFData (IORef a)Defined in deepseq-1.5.2.0 · Control.DeepSeq

    NOTE: Only strict in the reference and not the referenced value.